123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <UserControl x:Class="Aitex.Core.UI.Control.FlowPipe"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:ctrl="clr-namespace:Aitex.Core.Util"
- Name="flowPipeControl" Width="100" Height="8">
- <UserControl.RenderTransform>
- <RotateTransform Angle="0" x:Name="rotateTransform"/>
- </UserControl.RenderTransform>
- <Canvas MinHeight="4" MinWidth="100">
- <Canvas.Resources>
- <Style x:Key="AnimatingFlow" TargetType="{x:Type Path}">
- <Style.Triggers>
- <MultiDataTrigger>
- <MultiDataTrigger.Conditions>
- <Condition Value="true" >
- <Condition.Binding>
- <MultiBinding>
- <MultiBinding.Converter>
- <ctrl:FlowConverterForAllTrueMultiBinding></ctrl:FlowConverterForAllTrueMultiBinding>
- </MultiBinding.Converter>
- <MultiBinding.Bindings>
- <Binding Path="IsFlowing.Feedback" ElementName="flowPipeControl"></Binding>
- <Binding Path="IsSlowFlowing.Feedback" ElementName="flowPipeControl"></Binding>
- </MultiBinding.Bindings>
- </MultiBinding>
- </Condition.Binding>
- </Condition>
- <Condition Binding="{Binding ElementName=flowPipeControl, Path=IsReverse}" Value="true" />
- </MultiDataTrigger.Conditions>
- <MultiDataTrigger.EnterActions>
- <BeginStoryboard Name="FlowStoryboard">
- <Storyboard RepeatBehavior="Forever" Timeline.DesiredFrameRate="10">
- <!--<Gas flows from right to left or bottom to top>-->
- <DoubleAnimation Storyboard.TargetProperty="StrokeDashOffset" Duration="0:0:10" By="70" />
- </Storyboard>
- </BeginStoryboard>
- </MultiDataTrigger.EnterActions>
- <MultiDataTrigger.ExitActions>
- <BeginStoryboard>
- <Storyboard FillBehavior="Stop">
- <DoubleAnimation Storyboard.TargetProperty="StrokeDashOffset" Duration="0" />
- </Storyboard>
- </BeginStoryboard>
- <StopStoryboard BeginStoryboardName="FlowStoryboard" />
- </MultiDataTrigger.ExitActions>
- </MultiDataTrigger>
- <MultiDataTrigger>
- <MultiDataTrigger.Conditions>
- <Condition Value="true" >
- <Condition.Binding>
- <MultiBinding>
- <MultiBinding.Converter>
- <ctrl:FlowConverterForAllTrueMultiBinding></ctrl:FlowConverterForAllTrueMultiBinding>
- </MultiBinding.Converter>
- <MultiBinding.Bindings>
- <Binding Path="IsFlowing.Feedback" ElementName="flowPipeControl"></Binding>
- <Binding Path="IsSlowFlowing.Feedback" ElementName="flowPipeControl"></Binding>
- </MultiBinding.Bindings>
- </MultiBinding>
- </Condition.Binding>
- </Condition>
- <Condition Binding="{Binding ElementName=flowPipeControl, Path=IsReverse}" Value="false" />
- </MultiDataTrigger.Conditions>
- <MultiDataTrigger.EnterActions>
- <BeginStoryboard Name="ReverseFlowStoryboard">
- <Storyboard RepeatBehavior="Forever" Timeline.DesiredFrameRate="10">
- <!--<Gas flows from left to right or top to bottom>-->
- <DoubleAnimation Storyboard.TargetProperty="StrokeDashOffset" Duration="0:0:10" By="-70" />
- </Storyboard>
- </BeginStoryboard>
- </MultiDataTrigger.EnterActions>
- <MultiDataTrigger.ExitActions>
- <BeginStoryboard>
- <Storyboard FillBehavior="Stop">
- <DoubleAnimation Storyboard.TargetProperty="StrokeDashOffset" Duration="0" />
- </Storyboard>
- </BeginStoryboard>
- <StopStoryboard BeginStoryboardName="ReverseFlowStoryboard" />
- </MultiDataTrigger.ExitActions>
- </MultiDataTrigger>
- </Style.Triggers>
- </Style>
- </Canvas.Resources>
- <Path Name="path1" Fill="Red" Stretch="Fill"
- Width="{Binding ElementName=flowPipeControl,Path=Width}"
- Height="{Binding ElementName=flowPipeControl,Path=Height}"
- Stroke="Green" StrokeDashArray="1,3" StrokeDashCap="Round" StrokeThickness="5"
- Style="{StaticResource AnimatingFlow}">
- <Path.Data>
- <PathGeometry>
- <PathGeometry.Figures>
- <PathFigureCollection>
- <PathFigure StartPoint="0,0">
- <PathFigure.Segments>
- <LineSegment Point="80,0" />
- </PathFigure.Segments>
- </PathFigure>
- </PathFigureCollection>
- </PathGeometry.Figures>
- </PathGeometry>
- </Path.Data>
- </Path>
- <Border x:Name="border1" CornerRadius="1" BorderBrush="Gray" BorderThickness="1" Opacity="0.5"
- Width="{Binding ElementName=flowPipeControl,Path=Width}" Height="{Binding ElementName=flowPipeControl,Path=Height}">
- <Border.Background>
- <LinearGradientBrush StartPoint="0.5 0" EndPoint="0.5 1">
- <GradientStop Color="Gray" Offset="0"/>
- <GradientStop Color="White" Offset="0.5"/>
- <GradientStop Color="Gray" Offset="1"/>
- </LinearGradientBrush>
- </Border.Background>
- </Border>
- </Canvas>
- </UserControl>
|