PathButtonStyle.xaml 13 KB

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