CustomBtnStyle.xaml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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. >
  5. <SolidColorBrush x:Key="Common.Border" Color="#FF273C62"/>
  6. <SolidColorBrush x:Key="Common.ForGround.Blue" Color="#FF273C62"/>
  7. <SolidColorBrush x:Key="Common.ForGround.Black" Color="#FF000000"/>
  8. <SolidColorBrush x:Key="Button.Static.Background" Color="#273C62"/>
  9. <SolidColorBrush x:Key="Button.Static.Border" Color="#FF273C62"/>
  10. <SolidColorBrush x:Key="Button.MouseOver.Background" Color="#1A477EDE"/>
  11. <SolidColorBrush x:Key="Button.MouseOver.Border" Color="#273C62"/>
  12. <SolidColorBrush x:Key="Button.Pressed.Background" Color="#29477EDE"/>
  13. <SolidColorBrush x:Key="Button.Pressed.Border" Color="#FF2C628B"/>
  14. <SolidColorBrush x:Key="Button.Disabled.Background" Color="#273C62"/>
  15. <SolidColorBrush x:Key="Button.Disabled.Border" Color="#273C62"/>
  16. <SolidColorBrush x:Key="Button.Disabled.Foreground" Color="#26FFFFFF"/>
  17. <SolidColorBrush x:Key="CloseButton.MouseOver.Foreground" Color="Red"/>
  18. <SolidColorBrush x:Key="Disabled.ForeGround" Color="#FFE2E3E6" />
  19. <SolidColorBrush x:Key="BlueBtn.Mouseover.Background" Color="#31538D" />
  20. <SolidColorBrush x:Key="BlueBtn.Pressed.Background" Color="#1B2944" />
  21. <SolidColorBrush x:Key="Redact.Background" Color="#477EDE"/>
  22. <Style x:Key="ToggleBtnViewModeStyle" TargetType="customControl:CustomIconToggleBtn">
  23. <Setter Property="Background" Value="{StaticResource Button.Static.Background}"/>
  24. <Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}"/>
  25. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
  26. <Setter Property="BorderThickness" Value="0"/>
  27. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  28. <Setter Property="Height" Value="40"/>
  29. <Setter Property="Margin" Value="4,0,4,0"/>
  30. <Setter Property="Template">
  31. <Setter.Value>
  32. <ControlTemplate TargetType="customControl:CustomIconToggleBtn">
  33. <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
  34. <Grid >
  35. <Grid Width="40" Height="40" VerticalAlignment="Center" HorizontalAlignment="Center">
  36. <Image x:Name="ImageIcon" Width="20" Height="20" Source="{Binding Icon,RelativeSource={RelativeSource Mode=TemplatedParent}}" Visibility="Collapsed"/>
  37. </Grid>
  38. <ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  39. </Grid>
  40. </Border>
  41. <ControlTemplate.Triggers>
  42. <Trigger Property="IsMouseOver" Value="true">
  43. <Setter Property="Background" TargetName="border" Value="{StaticResource Button.MouseOver.Background}"/>
  44. <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.MouseOver.Border}"/>
  45. </Trigger>
  46. <Trigger Property="IsPressed" Value="true">
  47. <Setter Property="Background" TargetName="border" Value="{StaticResource Button.Pressed.Background}"/>
  48. <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Pressed.Border}"/>
  49. </Trigger>
  50. <Trigger Property="IsEnabled" Value="false">
  51. <Setter Property="Background" TargetName="border" Value="{StaticResource Button.Disabled.Background}"/>
  52. <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Disabled.Border}"/>
  53. <Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{StaticResource Button.Disabled.Foreground}"/>
  54. <Setter Property="Opacity" TargetName="contentPresenter" Value="0.5"/>
  55. </Trigger>
  56. </ControlTemplate.Triggers>
  57. </ControlTemplate>
  58. </Setter.Value>
  59. </Setter>
  60. <Style.Triggers>
  61. <Trigger Property="IsChecked" Value="True">
  62. <Setter Property="Background" Value="{StaticResource Button.Pressed.Background}"></Setter>
  63. </Trigger>
  64. <Trigger Property="IsChecked" Value="False">
  65. <Setter Property="Background" Value="Transparent"></Setter>
  66. </Trigger>
  67. <Trigger Property="IsChecked" Value="{x:Null}">
  68. <Setter Property="Background" Value="Transparent"></Setter>
  69. </Trigger>
  70. </Style.Triggers>
  71. </Style>
  72. <SolidColorBrush x:Key="Button.Select.Background" Color="#1770F4" Opacity="0.1"/>
  73. <SolidColorBrush x:Key="Button.SelectForeground.Background" Color="#1770F4"/>
  74. <Style x:Key="ToggleBtnSelectStyle" TargetType="customControl:CustomIconToggleBtn">
  75. <Setter Property="Background" Value="{StaticResource Button.Static.Background}"/>
  76. <Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}"/>
  77. <Setter Property="Foreground" Value="#8F96A7"/>
  78. <Setter Property="BorderThickness" Value="0"/>
  79. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  80. <Setter Property="Height" Value="40"/>
  81. <Setter Property="Margin" Value="4,0,4,0"/>
  82. <Setter Property="Template">
  83. <Setter.Value>
  84. <ControlTemplate TargetType="customControl:CustomIconToggleBtn">
  85. <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="4" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
  86. <Grid >
  87. <Grid Width="40" Height="40" VerticalAlignment="Center" HorizontalAlignment="Center">
  88. <Image x:Name="ImageIcon" Width="20" Height="20" Source="{Binding Icon,RelativeSource={RelativeSource Mode=TemplatedParent}}" Visibility="Collapsed"/>
  89. </Grid>
  90. <ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  91. </Grid>
  92. </Border>
  93. <ControlTemplate.Triggers>
  94. <Trigger Property="IsMouseOver" Value="true">
  95. <Setter Property="Background" TargetName="border" Value="{StaticResource Button.MouseOver.Background}"/>
  96. <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.MouseOver.Border}"/>
  97. </Trigger>
  98. <Trigger Property="IsPressed" Value="true">
  99. <Setter Property="Background" TargetName="border" Value="{StaticResource Button.Pressed.Background}"/>
  100. <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Pressed.Border}"/>
  101. </Trigger>
  102. <Trigger Property="IsEnabled" Value="false">
  103. <Setter Property="Background" TargetName="border" Value="{StaticResource Button.Disabled.Background}"/>
  104. <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Disabled.Border}"/>
  105. <Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="{StaticResource Button.Disabled.Foreground}"/>
  106. <Setter Property="Opacity" TargetName="contentPresenter" Value="0.5"/>
  107. </Trigger>
  108. </ControlTemplate.Triggers>
  109. </ControlTemplate>
  110. </Setter.Value>
  111. </Setter>
  112. <Style.Triggers>
  113. <Trigger Property="IsChecked" Value="True">
  114. <Setter Property="Background" Value="{StaticResource Button.Select.Background}"></Setter>
  115. <Setter Property="Foreground" Value="{StaticResource Button.SelectForeground.Background}"></Setter>
  116. </Trigger>
  117. <Trigger Property="IsChecked" Value="False">
  118. <Setter Property="Background" Value="Transparent"></Setter>
  119. </Trigger>
  120. <Trigger Property="IsChecked" Value="{x:Null}">
  121. <Setter Property="Background" Value="Transparent"></Setter>
  122. </Trigger>
  123. </Style.Triggers>
  124. </Style>
  125. <Style x:Key="BlueBtnStyle" TargetType="{x:Type Button}">
  126. <Setter Property="Background" Value="#1460F3"/>
  127. <Setter Property="Template">
  128. <Setter.Value>
  129. <ControlTemplate TargetType="{x:Type Button}">
  130. <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="4" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
  131. <ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  132. </Border>
  133. <ControlTemplate.Triggers>
  134. <Trigger Property="IsMouseOver" Value="true">
  135. <Setter Property="Background" TargetName="border" Value="{StaticResource BlueBtn.Mouseover.Background}"/>
  136. </Trigger>
  137. <Trigger Property="IsPressed" Value="true">
  138. <Setter Property="Background" TargetName="border" Value="{StaticResource BlueBtn.Pressed.Background}"/>
  139. </Trigger>
  140. <Trigger Property="IsEnabled" Value="false">
  141. <Setter Property="Background" TargetName="border" Value="#33000000"/>
  142. <Setter Property="BorderBrush" TargetName="border" Value="{StaticResource Button.Disabled.Border}"/>
  143. <Setter Property="TextElement.Foreground" TargetName="contentPresenter" Value="#FF999999"/>
  144. <Setter Property="Opacity" TargetName="contentPresenter" Value="0.5"/>
  145. </Trigger>
  146. </ControlTemplate.Triggers>
  147. </ControlTemplate>
  148. </Setter.Value>
  149. </Setter>
  150. </Style>
  151. </ResourceDictionary>