终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

77 line
4.0 KiB

  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  2. <ControlTemplate x:Key="CbTemplate" TargetType="{x:Type CheckBox}">
  3. <Grid Background="Transparent">
  4. <Grid.ColumnDefinitions>
  5. <ColumnDefinition Width="auto" />
  6. <ColumnDefinition />
  7. </Grid.ColumnDefinitions>
  8. <Viewbox
  9. Width="{TemplateBinding Height}"
  10. Height="{TemplateBinding Height}"
  11. HorizontalAlignment="Left">
  12. <Grid Width="20" Height="20">
  13. <!-- 需要设置选择框的圆角 RadiusX="4" RadiusY="4" -->
  14. <Rectangle Stroke="{TemplateBinding Background}" />
  15. <!-- M:表示起始点 点1的位置 L:直线 点2的位置 点3的位置 点4的位置 点5的位置 Z:结束 -->
  16. <Path
  17. x:Name="path"
  18. Data="M 2,9 L 9,17 17,3 8,12 Z"
  19. Fill="{TemplateBinding Background}"
  20. RenderTransformOrigin="0.5,0.5"
  21. StrokeThickness="2">
  22. <Path.RenderTransform>
  23. <TransformGroup>
  24. <ScaleTransform ScaleX="0" ScaleY="0" />
  25. <SkewTransform />
  26. <RotateTransform />
  27. <TranslateTransform />
  28. </TransformGroup>
  29. </Path.RenderTransform>
  30. </Path>
  31. </Grid>
  32. </Viewbox>
  33. <ContentPresenter
  34. Name="cb"
  35. Grid.Column="1"
  36. Margin="5,0,0,0"
  37. HorizontalAlignment="Left"
  38. VerticalAlignment="Center" />
  39. </Grid>
  40. <ControlTemplate.Triggers>
  41. <Trigger Property="IsChecked" Value="True">
  42. <Trigger.ExitActions>
  43. <BeginStoryboard>
  44. <Storyboard>
  45. <DoubleAnimationUsingKeyFrames Storyboard.TargetName="path" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
  46. <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0" />
  47. </DoubleAnimationUsingKeyFrames>
  48. <DoubleAnimationUsingKeyFrames Storyboard.TargetName="path" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
  49. <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0" />
  50. </DoubleAnimationUsingKeyFrames>
  51. </Storyboard>
  52. </BeginStoryboard>
  53. </Trigger.ExitActions>
  54. <Trigger.EnterActions>
  55. <BeginStoryboard>
  56. <Storyboard>
  57. <DoubleAnimationUsingKeyFrames Storyboard.TargetName="path" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
  58. <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1" />
  59. </DoubleAnimationUsingKeyFrames>
  60. <DoubleAnimationUsingKeyFrames Storyboard.TargetName="path" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
  61. <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1" />
  62. </DoubleAnimationUsingKeyFrames>
  63. </Storyboard>
  64. </BeginStoryboard>
  65. </Trigger.EnterActions>
  66. </Trigger>
  67. <!--<Trigger Property="IsMouseOver" Value="true">
  68. <Setter TargetName="cb" Property="HorizontalAlignment" Value="Center" />
  69. </Trigger>-->
  70. </ControlTemplate.Triggers>
  71. </ControlTemplate>
  72. </ResourceDictionary>