12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <UserControl x:Class="Venus_Themes.UserControls.Pipe"
- 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:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:local="clr-namespace:Venus_Themes.UserControls"
- mc:Ignorable="d"
- 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 Line}">
- <Style.Triggers>
- <DataTrigger Binding="{Binding ElementName=flowPipeControl,Path=IsFlowing}" Value="True">
- <DataTrigger.EnterActions>
- <BeginStoryboard Name="FlowStoryboard">
- <Storyboard RepeatBehavior="Forever" Timeline.DesiredFrameRate="10">
- <DoubleAnimation Storyboard.TargetProperty="StrokeDashOffset" Duration="0:0:10" By="70" />
- </Storyboard>
- </BeginStoryboard>
- </DataTrigger.EnterActions>
- <DataTrigger.ExitActions>
- <BeginStoryboard>
- <Storyboard FillBehavior="Stop">
- <DoubleAnimation Storyboard.TargetProperty="StrokeDashOffset" Duration="0"/>
- </Storyboard>
- </BeginStoryboard>
- <StopStoryboard BeginStoryboardName="FlowStoryboard"/>
- </DataTrigger.ExitActions>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- </Canvas.Resources>
- <Border x:Name="border1" BorderBrush="Gray" CornerRadius="3" BorderThickness="0,0,0,0"
- 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="Silver" Offset="0"/>
- <GradientStop Color="White" Offset="0.5"/>
- <GradientStop Color="Silver" Offset="1"/>
- </LinearGradientBrush>
- </Border.Background>
- </Border>
- <Line Name="path1" X1="0" Y1="0" X2="80" Y2="0" Stretch="Fill" Opacity="0.4"
- Width="{Binding ElementName=flowPipeControl,Path=Width}"
- Height="{Binding ElementName=border1,Path=Height}"
- Stroke="Green" StrokeDashArray="1,3" StrokeDashCap="Round" StrokeThickness="15"
- Style="{StaticResource AnimatingFlow}"/>
- </Canvas>
- </UserControl>
|