Pipe.xaml 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <UserControl x:Class="Venus_Themes.UserControls.Pipe"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:Venus_Themes.UserControls"
  7. mc:Ignorable="d"
  8. Name="flowPipeControl" Width="100" Height="8">
  9. <UserControl.RenderTransform>
  10. <RotateTransform Angle="0" x:Name="rotateTransform"/>
  11. </UserControl.RenderTransform>
  12. <Canvas MinHeight="4" MinWidth="100">
  13. <Canvas.Resources>
  14. <Style x:Key="AnimatingFlow" TargetType="{x:Type Line}">
  15. <Style.Triggers>
  16. <DataTrigger Binding="{Binding ElementName=flowPipeControl,Path=IsFlowing}" Value="True">
  17. <DataTrigger.EnterActions>
  18. <BeginStoryboard Name="FlowStoryboard">
  19. <Storyboard RepeatBehavior="Forever" Timeline.DesiredFrameRate="10">
  20. <DoubleAnimation Storyboard.TargetProperty="StrokeDashOffset" Duration="0:0:10" By="70" />
  21. </Storyboard>
  22. </BeginStoryboard>
  23. </DataTrigger.EnterActions>
  24. <DataTrigger.ExitActions>
  25. <BeginStoryboard>
  26. <Storyboard FillBehavior="Stop">
  27. <DoubleAnimation Storyboard.TargetProperty="StrokeDashOffset" Duration="0"/>
  28. </Storyboard>
  29. </BeginStoryboard>
  30. <StopStoryboard BeginStoryboardName="FlowStoryboard"/>
  31. </DataTrigger.ExitActions>
  32. </DataTrigger>
  33. </Style.Triggers>
  34. </Style>
  35. </Canvas.Resources>
  36. <Border x:Name="border1" BorderBrush="Gray" CornerRadius="3" BorderThickness="0,0,0,0"
  37. Width="{Binding ElementName=flowPipeControl,Path=Width}" Height="{Binding ElementName=flowPipeControl,Path=Height}">
  38. <Border.Background>
  39. <LinearGradientBrush StartPoint="0.5 0" EndPoint="0.5 1">
  40. <GradientStop Color="Silver" Offset="0"/>
  41. <GradientStop Color="White" Offset="0.5"/>
  42. <GradientStop Color="Silver" Offset="1"/>
  43. </LinearGradientBrush>
  44. </Border.Background>
  45. </Border>
  46. <Line Name="path1" X1="0" Y1="0" X2="80" Y2="0" Stretch="Fill" Opacity="0.4"
  47. Width="{Binding ElementName=flowPipeControl,Path=Width}"
  48. Height="{Binding ElementName=border1,Path=Height}"
  49. Stroke="Green" StrokeDashArray="1,3" StrokeDashCap="Round" StrokeThickness="15"
  50. Style="{StaticResource AnimatingFlow}"/>
  51. </Canvas>
  52. </UserControl>