DoubleArc.xaml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:UI="clr-namespace:CustomUI"
  4. xmlns:ec="http://schemas.microsoft.com/expression/2010/controls"
  5. xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing">
  6. <ControlTemplate x:Key="DoubleArc"
  7. TargetType="{x:Type UI:Loading}">
  8. <Grid x:Name="PART_Root" Background="{TemplateBinding Background}">
  9. <ed:Arc x:Name="PART_OutCircle" ArcThickness="5" ArcThicknessUnit="Pixel" EndAngle="360"
  10. Fill="{TemplateBinding Foreground}"
  11. Opacity="1" RenderTransformOrigin="0.5,0.5" StartAngle="90" Stretch="None">
  12. <ed:Arc.RenderTransform>
  13. <RotateTransform />
  14. </ed:Arc.RenderTransform>
  15. </ed:Arc>
  16. <ed:Arc x:Name="PART_InnerCircle" Margin="5" ArcThickness="5" ArcThicknessUnit="Pixel"
  17. EndAngle="150"
  18. Fill="{TemplateBinding Foreground}"
  19. Opacity="0.4" RenderTransformOrigin="0.5,0.5" StartAngle="-60" Stretch="None">
  20. <ed:Arc.RenderTransform>
  21. <RotateTransform />
  22. </ed:Arc.RenderTransform>
  23. </ed:Arc>
  24. <VisualStateManager.VisualStateGroups>
  25. <VisualStateGroup x:Name="ActiveStates">
  26. <VisualState x:Name="Inactive" />
  27. <VisualState x:Name="Active">
  28. <Storyboard SpeedRatio="{TemplateBinding SpeedRatio}">
  29. <DoubleAnimationUsingKeyFrames RepeatBehavior="Forever" Storyboard.TargetName="PART_OutCircle" Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)">
  30. <LinearDoubleKeyFrame KeyTime="0:0:0.000" Value="0" />
  31. <LinearDoubleKeyFrame KeyTime="0:0:3.000" Value="360" />
  32. </DoubleAnimationUsingKeyFrames>
  33. <DoubleAnimationUsingKeyFrames RepeatBehavior="Forever" Storyboard.TargetName="PART_InnerCircle" Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)">
  34. <LinearDoubleKeyFrame KeyTime="0:0:0.000" Value="0" />
  35. <LinearDoubleKeyFrame KeyTime="0:0:3.000" Value="-360" />
  36. </DoubleAnimationUsingKeyFrames>
  37. </Storyboard>
  38. </VisualState>
  39. </VisualStateGroup>
  40. </VisualStateManager.VisualStateGroups>
  41. </Grid>
  42. </ControlTemplate>
  43. </ResourceDictionary>