GroupBox.xaml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <ResourceDictionary
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  5. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  6. xmlns:themes="clr-namespace:MECF.Framework.UI.Client.Themes"
  7. mc:Ignorable="d">
  8. <Style TargetType="GroupBox">
  9. <Setter Property="FontSize" Value="20" />
  10. <Setter Property="BorderBrush" Value="Black" />
  11. </Style>
  12. <themes:CenterBorderGapMaskConverter x:Key="BorderGapMaskConverter"/>
  13. <Style x:Key="GroupboxWithoutWhiteBorder" TargetType="{x:Type GroupBox}">
  14. <Setter Property="BorderBrush" Value="#D5DFE5" />
  15. <Setter Property="BorderThickness" Value="1" />
  16. <Setter Property="Template">
  17. <Setter.Value>
  18. <ControlTemplate TargetType="{x:Type GroupBox}">
  19. <Grid SnapsToDevicePixels="true">
  20. <Grid.ColumnDefinitions>
  21. <ColumnDefinition Width="6" />
  22. <ColumnDefinition Width="Auto" />
  23. <ColumnDefinition Width="*" />
  24. <ColumnDefinition Width="6" />
  25. </Grid.ColumnDefinitions>
  26. <Grid.RowDefinitions>
  27. <RowDefinition Height="Auto" />
  28. <RowDefinition Height="Auto" />
  29. <RowDefinition Height="*" />
  30. <RowDefinition Height="6" />
  31. </Grid.RowDefinitions>
  32. <Border CornerRadius="4" Grid.Row="1" Grid.RowSpan="3" Grid.Column="0" Grid.ColumnSpan="4" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="Transparent" Background="{TemplateBinding Background}" />
  33. <Border Name="Header" Padding="3,1,3,0" Grid.Row="0" Grid.RowSpan="2" Grid.Column="1">
  34. <ContentPresenter ContentSource="Header" RecognizesAccessKey="true" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  35. </Border>
  36. <ContentPresenter Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  37. <Border Grid.Row="1" Grid.RowSpan="3" Grid.ColumnSpan="4" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="3">
  38. <Border.OpacityMask>
  39. <MultiBinding Converter="{StaticResource BorderGapMaskConverter}" ConverterParameter="7">
  40. <Binding ElementName="Header" Path="ActualWidth" />
  41. <Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}" />
  42. <Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}" />
  43. </MultiBinding>
  44. </Border.OpacityMask>
  45. </Border>
  46. </Grid>
  47. </ControlTemplate>
  48. </Setter.Value>
  49. </Setter>
  50. </Style>
  51. <Style x:Key="GroupboxWithoutWhiteBorder2" TargetType="{x:Type GroupBox}">
  52. <Setter Property="BorderBrush" Value="#D5DFE5"/>
  53. <Setter Property="BorderThickness" Value="1"/>
  54. <Setter Property="FontSize" Value="20" />
  55. <Setter Property="Foreground" Value="White"></Setter>
  56. <Setter Property="Template">
  57. <Setter.Value>
  58. <ControlTemplate TargetType="{x:Type GroupBox}">
  59. <Grid SnapsToDevicePixels="true">
  60. <Grid.ColumnDefinitions>
  61. <ColumnDefinition Width="6"/>
  62. <ColumnDefinition Width="Auto"/>
  63. <ColumnDefinition Width="*"/>
  64. <ColumnDefinition Width="6"/>
  65. </Grid.ColumnDefinitions>
  66. <Grid.RowDefinitions>
  67. <RowDefinition Height="Auto"/>
  68. <RowDefinition Height="Auto"/>
  69. <RowDefinition Height="*"/>
  70. <RowDefinition Height="6"/>
  71. </Grid.RowDefinitions>
  72. <Border BorderBrush="Transparent" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Grid.ColumnSpan="4" Grid.Column="0" CornerRadius="4" Grid.Row="1" Grid.RowSpan="3"/>
  73. <Border Grid.ZIndex="2" x:Name="Header" Grid.Column="2" HorizontalAlignment="Center" Padding="3,1,3,0" Grid.Row="0" Grid.RowSpan="2">
  74. <ContentPresenter ContentSource="Header" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
  75. </Border>
  76. <ContentPresenter Grid.ColumnSpan="2" Grid.Column="1" Margin="{TemplateBinding Padding}" Grid.Row="2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
  77. <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="4" CornerRadius="3" Grid.Row="1" Grid.RowSpan="3">
  78. <Border.OpacityMask>
  79. <MultiBinding ConverterParameter="7" Converter="{StaticResource BorderGapMaskConverter}">
  80. <Binding ElementName="Header" Path="ActualWidth"/>
  81. <Binding Path="ActualWidth" RelativeSource="{RelativeSource Self}"/>
  82. <Binding Path="ActualHeight" RelativeSource="{RelativeSource Self}"/>
  83. </MultiBinding>
  84. </Border.OpacityMask>
  85. <!--<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="3">
  86. <Border BorderBrush="White" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2"/>
  87. </Border>-->
  88. </Border>
  89. </Grid>
  90. </ControlTemplate>
  91. </Setter.Value>
  92. </Setter>
  93. </Style>
  94. </ResourceDictionary>