终端一体化运控平台
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 

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