PathRadioButtonDictionary.xaml 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:customControl="clr-namespace:PDF_Office.CustomControl">
  4. <Style TargetType="{x:Type customControl:PathRadioButton}" >
  5. <Setter Property="IconOpacity" Value="1" />
  6. <Setter Property="IconMouseOverOpacity" Value="1" />
  7. <Setter Property="IconPressOpacity" Value="1" />
  8. <Setter Property="IconCheckedOpacity" Value="1" />
  9. <Setter Property="Background" Value="Transparent" />
  10. <Setter Property="Template">
  11. <Setter.Value>
  12. <ControlTemplate TargetType="{x:Type customControl:PathRadioButton}">
  13. <Border
  14. Background="{TemplateBinding Background}"
  15. BorderBrush="{TemplateBinding BorderBrush}"
  16. BorderThickness="{TemplateBinding BorderThickness}">
  17. <Grid x:Name="grid" Background="{TemplateBinding Background}">
  18. <Border
  19. x:Name="PART_Border"
  20. Background="{TemplateBinding Background}"
  21. BorderBrush="{TemplateBinding BorderBrush}"
  22. BorderThickness="{TemplateBinding BorderThickness}"
  23. CornerRadius="{TemplateBinding CornerRadius}" />
  24. <Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}">
  25. <StackPanel
  26. Margin="{TemplateBinding Padding}"
  27. HorizontalAlignment="Center"
  28. VerticalAlignment="Center"
  29. Orientation="{TemplateBinding IconContentOrientation}">
  30. <Grid HorizontalAlignment="Center" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
  31. <Path
  32. x:Name="PART_Icon"
  33. Width="{TemplateBinding IconWidth}"
  34. Height="{TemplateBinding IconHeight}"
  35. Data="{TemplateBinding Icon}"
  36. Fill="{TemplateBinding IconFill}"
  37. Opacity="{TemplateBinding IconOpacity}" />
  38. <Path
  39. x:Name="PART_MouseOverIcon"
  40. Width="{TemplateBinding IconWidth}"
  41. Height="{TemplateBinding IconHeight}"
  42. Data="{TemplateBinding IconMouseOver}"
  43. Fill="{TemplateBinding IconMouseOverFill}"
  44. Opacity="{TemplateBinding IconMouseOverOpacity}"
  45. Visibility="Collapsed" />
  46. <Path
  47. x:Name="PART_PressIcon"
  48. Width="{TemplateBinding IconWidth}"
  49. Height="{TemplateBinding IconHeight}"
  50. Data="{TemplateBinding IconPress}"
  51. Fill="{TemplateBinding IconPressFill}"
  52. Opacity="{TemplateBinding IconPressOpacity}"
  53. Visibility="Collapsed" />
  54. <Path
  55. x:Name="PART_CheckedIcon"
  56. Width="{TemplateBinding IconWidth}"
  57. Height="{TemplateBinding IconHeight}"
  58. Data="{TemplateBinding IconChecked}"
  59. Fill="{TemplateBinding IconCheckedFill}"
  60. Opacity="{TemplateBinding IconCheckedOpacity}"
  61. Visibility="Collapsed" />
  62. </Grid>
  63. <TextBlock
  64. x:Name="PART_Content"
  65. Margin="{TemplateBinding IconContentMargin}"
  66. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  67. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  68. Foreground="{TemplateBinding Foreground}"
  69. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
  70. Text="{TemplateBinding Content}"
  71. TextTrimming="CharacterEllipsis" />
  72. </StackPanel>
  73. </Grid>
  74. </Grid>
  75. </Border>
  76. <ControlTemplate.Triggers>
  77. <Trigger Property="IsMouseOver" Value="True">
  78. <Setter TargetName="PART_Content" Property="Foreground" Value="{Binding MouseOverForeground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathRadioButton}}}" />
  79. <Setter TargetName="PART_Border" Property="Background" Value="{Binding MouseOverBackground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathRadioButton}}}" />
  80. <Setter TargetName="PART_Border" Property="BorderBrush" Value="{Binding MouseOverBorderBrush, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathRadioButton}}}" />
  81. <Setter TargetName="PART_MouseOverIcon" Property="Visibility" Value="Visible" />
  82. <Setter TargetName="PART_Icon" Property="Visibility" Value="Collapsed" />
  83. <Setter TargetName="PART_PressIcon" Property="Visibility" Value="Collapsed" />
  84. <Setter TargetName="PART_CheckedIcon" Property="Visibility" Value="Collapsed" />
  85. </Trigger>
  86. <Trigger Property="IsPressed" Value="True">
  87. <Setter TargetName="PART_Content" Property="Foreground" Value="{Binding MouseDownForeground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathRadioButton}}}" />
  88. <Setter TargetName="PART_Border" Property="Background" Value="{Binding MouseDownBackground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathRadioButton}}}" />
  89. <Setter TargetName="PART_Border" Property="BorderBrush" Value="{Binding MouseDownBorderBrush, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathRadioButton}}}" />
  90. <Setter TargetName="PART_PressIcon" Property="Visibility" Value="Visible" />
  91. <Setter TargetName="PART_Icon" Property="Visibility" Value="Collapsed" />
  92. <Setter TargetName="PART_MouseOverIcon" Property="Visibility" Value="Collapsed" />
  93. <Setter TargetName="PART_CheckedIcon" Property="Visibility" Value="Collapsed" />
  94. </Trigger>
  95. <Trigger Property="IsEnabled" Value="False">
  96. <Setter Property="Opacity" Value="0.5" />
  97. </Trigger>
  98. <Trigger Property="IsChecked" Value="True">
  99. <Setter TargetName="PART_Content" Property="Foreground" Value="{Binding MouseOverForeground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathRadioButton}}}" />
  100. <Setter TargetName="PART_Border" Property="Background" Value="{Binding MouseOverBackground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathRadioButton}}}" />
  101. <Setter TargetName="PART_Border" Property="BorderBrush" Value="{Binding MouseOverBorderBrush, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:PathRadioButton}}}" />
  102. <Setter TargetName="PART_MouseOverIcon" Property="Visibility" Value="Collapsed" />
  103. <Setter TargetName="PART_Icon" Property="Visibility" Value="Collapsed" />
  104. <Setter TargetName="PART_PressIcon" Property="Visibility" Value="Collapsed" />
  105. <Setter TargetName="PART_CheckedIcon" Property="Visibility" Value="Visible" />
  106. </Trigger>
  107. <Trigger SourceName="PART_Content" Property="Text" Value="">
  108. <Setter TargetName="PART_Content" Property="Visibility" Value="Collapsed" />
  109. </Trigger>
  110. <Trigger SourceName="PART_Content" Property="Text" Value="{x:Null}">
  111. <Setter TargetName="PART_Content" Property="Visibility" Value="Collapsed" />
  112. </Trigger>
  113. </ControlTemplate.Triggers>
  114. </ControlTemplate>
  115. </Setter.Value>
  116. </Setter>
  117. </Style>
  118. </ResourceDictionary>