MenuButton.xaml 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:local="clr-namespace:LRH.Controls">
  4. <Style TargetType="Button" x:Key="MenuButton">
  5. <Setter Property="Width" Value="20"/>
  6. <Setter Property="Height" Value="20"/>
  7. <Setter Property="VerticalAlignment" Value="Center"/>
  8. <Setter Property="Background" Value="Transparent"></Setter>
  9. <Style.Triggers>
  10. <Trigger Property="IsMouseOver" Value="true">
  11. <Setter Property="Opacity" Value="0.3"></Setter>
  12. <Setter Property="Background" Value="White"/>
  13. <Setter Property="Foreground" Value="OrangeRed"/>
  14. </Trigger>
  15. </Style.Triggers>
  16. </Style>
  17. <Style TargetType="Button" x:Key="{x:Static local:WindowBase.CloseButtonStyleKey}" BasedOn="{StaticResource MenuButton}">
  18. <Setter Property="ToolTip" Value="关闭"/>
  19. <Setter Property="Template">
  20. <Setter.Value>
  21. <ControlTemplate TargetType="Button">
  22. <Border Name="bdPanel" SnapsToDevicePixels="true" Background="{TemplateBinding Background}">
  23. <TextBlock Name="txtContent" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="{TemplateBinding Foreground}" Text="×"></TextBlock>
  24. </Border>
  25. </ControlTemplate>
  26. </Setter.Value>
  27. </Setter>
  28. <Style.Triggers>
  29. <Trigger Property="IsMouseOver" Value="true">
  30. <Setter Property="Opacity" Value="0.5"></Setter>
  31. <Setter Property="Background" Value="Red"/>
  32. <Setter Property="Foreground" Value="Black"/>
  33. </Trigger>
  34. </Style.Triggers>
  35. </Style>
  36. <Style TargetType="Button" x:Key="{x:Static local:WindowBase.RestoreButtonKey}" BasedOn="{StaticResource MenuButton}">
  37. <Setter Property="ToolTip" Value="还原"/>
  38. <Setter Property="Template">
  39. <Setter.Value>
  40. <ControlTemplate TargetType="Button">
  41. <Border Name="bdPanel" SnapsToDevicePixels="true" Background="{TemplateBinding Background}">
  42. <TextBlock Name="txtContent" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="{TemplateBinding Foreground}" Text="❐"></TextBlock>
  43. </Border>
  44. </ControlTemplate>
  45. </Setter.Value>
  46. </Setter>
  47. </Style>
  48. <Style TargetType="Button" x:Key="{x:Static local:WindowBase.MinButtonStyleKey}" BasedOn="{StaticResource MenuButton}">
  49. <Setter Property="ToolTip" Value="最小化"/>
  50. <Setter Property="Template">
  51. <Setter.Value>
  52. <ControlTemplate TargetType="Button">
  53. <Border Name="bdPanel" SnapsToDevicePixels="true" Background="{TemplateBinding Background}">
  54. <TextBlock Name="txtContent" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="{TemplateBinding Foreground}" Text="-"></TextBlock>
  55. </Border>
  56. </ControlTemplate>
  57. </Setter.Value>
  58. </Setter>
  59. </Style>
  60. <Style TargetType="Button" x:Key="{x:Static local:WindowBase.MaxButtonStyleKey}" BasedOn="{StaticResource MenuButton}">
  61. <Setter Property="ToolTip" Value="最大化"/>
  62. <Setter Property="Template">
  63. <Setter.Value>
  64. <ControlTemplate TargetType="Button">
  65. <Border Name="bdPanel" SnapsToDevicePixels="true" Background="{TemplateBinding Background}">
  66. <TextBlock Name="txtContent" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="{TemplateBinding Foreground}" Text="□"></TextBlock>
  67. </Border>
  68. </ControlTemplate>
  69. </Setter.Value>
  70. </Setter>
  71. </Style>
  72. </ResourceDictionary>