add groupbox style

This commit is contained in:
NaBian committed 2018-11-20 17:37:17 +08:00
1 parent ed8ef8c7a9
commit c787df001b
14 files changed
+166 -1

No files matched your search

+8
View File
@@ -267,6 +267,14 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\Styles\GroupBox.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\Styles\Base\GroupBoxBaseStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\Styles\Base\LabelBaseStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -0,0 +1,35 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:HandyControl.Controls">
<Style x:Key="GroupBoxBaseStyle" TargetType="GroupBox">
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"/>
<Setter Property="controls:TitleElement.Background" Value="{DynamicResource TitleBrush}"/>
<Setter Property="controls:BorderElement.CornerRadius" Value="4"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Padding" Value="4"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="GroupBox">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" MinHeight="30"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border MinHeight="30" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{Binding Path=(controls:TitleElement.Background),RelativeSource={RelativeSource TemplatedParent}}" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" Margin="0,0,0,6">
<ContentPresenter TextElement.Foreground="{TemplateBinding Foreground}" Margin="10,0" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" ContentSource="Header" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Border>
<Border Grid.Row="1" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
<ContentPresenter Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
+52
View File
@@ -0,0 +1,52 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:HandyControl.Controls">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Base/GroupBoxBaseStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style BasedOn="{StaticResource GroupBoxBaseStyle}" TargetType="GroupBox"/>
<Style x:Key="GroupBoxOriginal" BasedOn="{StaticResource GroupBoxBaseStyle}" TargetType="GroupBox">
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="GroupBox">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<ContentPresenter TextElement.Foreground="{TemplateBinding Foreground}" Margin="10,0,10,6" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" ContentSource="Header" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
<Border Grid.Row="1" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
<ContentPresenter Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="GroupBoxTab" BasedOn="{StaticResource GroupBoxBaseStyle}" TargetType="GroupBox">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="GroupBox">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" MinHeight="30"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border Grid.Row="1" CornerRadius="0,0,4,4" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
<ContentPresenter Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Border>
<Border Grid.Row="0" MinHeight="30" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{Binding Path=(controls:TitleElement.Background),RelativeSource={RelativeSource TemplatedParent}}" CornerRadius="4,4,0,0">
<ContentPresenter TextElement.Foreground="{TemplateBinding Foreground}" Margin="10,0" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" ContentSource="Header" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
+1
View File
@@ -40,6 +40,7 @@
<ResourceDictionary Source="ImageViewer.xaml"/>
<ResourceDictionary Source="CalendarWithClock.xaml"/>
<ResourceDictionary Source="DateTimePicker.xaml"/>
<ResourceDictionary Source="GroupBox.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
+2
View File
@@ -94,6 +94,8 @@
public static readonly string SliderDemoCtl = nameof(SliderDemoCtl);
public static readonly string GroupBoxDemoCtl = nameof(GroupBoxDemoCtl);
public static readonly string CommonWindow = nameof(CommonWindow);
public static readonly string CustomNonClientAreaWindow = nameof(CustomNonClientAreaWindow);
+2 -1
View File
@@ -52,7 +52,8 @@ var styleList = new List<string>
"RadioButtonDemoCtl",
"NaiveScrollViewerDemoCtl",
"BrushDemoCtl",
"SliderDemoCtl"
"SliderDemoCtl",
"GroupBoxDemoCtl"
};
var windowList = new List<string>
{
+8
View File
@@ -183,6 +183,9 @@
<Compile Include="UserControl\Styles\CheckBoxDemoCtl.xaml.cs">
<DependentUpon>CheckBoxDemoCtl.xaml</DependentUpon>
</Compile>
<Compile Include="UserControl\Styles\GroupBoxDemoCtl.xaml.cs">
<DependentUpon>GroupBoxDemoCtl.xaml</DependentUpon>
</Compile>
<Compile Include="UserControl\Styles\NaiveComboBoxDemoCtl.xaml.cs">
<DependentUpon>NaiveComboBoxDemoCtl.xaml</DependentUpon>
</Compile>
@@ -437,6 +440,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UserControl\Styles\GroupBoxDemoCtl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UserControl\Styles\NaiveComboBoxDemoCtl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -557,6 +564,7 @@
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>MessageToken.cs</LastGenOutput>
</Content>
<Resource Include="Resources\Img\LeftMainContent\GroupBox_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\ColorWheel_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\Slider_16x.png" />
<Resource Include="Resources\Img\LeftMainContent\HoverMenu_16x.png" />
+9
View File
@@ -375,6 +375,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
/// <summary>
/// 查找类似 分组框 的本地化字符串。
/// </summary>
public static string GroupBox {
get {
return ResourceManager.GetString("GroupBox", resourceCulture);
}
}
/// <summary>
/// 查找类似 信息通知 的本地化字符串。
/// </summary>
@@ -405,4 +405,7 @@
<data name="DateTimePicker" xml:space="preserve">
<value>DateTimePicker</value>
</data>
<data name="GroupBox" xml:space="preserve">
<value>GroupBox</value>
</data>
</root>
@@ -385,4 +385,7 @@
<data name="DateTimePicker" xml:space="preserve">
<value>日期时间选择器</value>
</data>
<data name="GroupBox" xml:space="preserve">
<value>分组框</value>
</data>
</root>
Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

@@ -110,6 +110,11 @@
<Image Source="../../Resources/Img/LeftMainContent/ListBox_16x.png"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.GroupBoxDemoCtl}" Content="{x:Static langs:Lang.GroupBox}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/LeftMainContent/GroupBox_16x.png"/>
</controls:EdgeElement.LeftContent>
</ListBoxItem>
<ListBoxItem Tag="{x:Static data:MessageToken.MenuDemoCtl}" Content="{x:Static langs:Lang.Menu}">
<controls:EdgeElement.LeftContent>
<Image Source="../../Resources/Img/LeftMainContent/ContextMenu_16x.png"/>
@@ -0,0 +1,28 @@
<UserControl x:Class="HandyControlDemo.UserControl.GroupBoxDemoCtl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Background="{DynamicResource RegionBrush}"
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl">
<controls:TransitioningContentControl>
<ScrollViewer>
<UniformGrid Margin="32">
<GroupBox Width="300" Height="300" Header="{x:Static langs:Lang.TitleDemoStr1}" Padding="10" Margin="16">
<Border Background="{DynamicResource PrimaryBrush}" CornerRadius="4">
<TextBlock Text="{x:Static langs:Lang.ContentDemoStr}" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"/>
</Border>
</GroupBox>
<GroupBox Width="300" Height="300" Header="{x:Static langs:Lang.TitleDemoStr1}" Padding="10" Margin="16" Style="{StaticResource GroupBoxOriginal}" HorizontalContentAlignment="Left">
<Border Background="{DynamicResource PrimaryBrush}" CornerRadius="4">
<TextBlock Text="{x:Static langs:Lang.ContentDemoStr}" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"/>
</Border>
</GroupBox>
<GroupBox Width="300" Height="300" Header="{x:Static langs:Lang.TitleDemoStr1}" Padding="10" Margin="16" Style="{StaticResource GroupBoxTab}">
<Border Background="{DynamicResource PrimaryBrush}" CornerRadius="4">
<TextBlock Text="{x:Static langs:Lang.ContentDemoStr}" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White"/>
</Border>
</GroupBox>
</UniformGrid>
</ScrollViewer>
</controls:TransitioningContentControl>
</UserControl>
@@ -0,0 +1,10 @@
namespace HandyControlDemo.UserControl
{
public partial class GroupBoxDemoCtl
{
public GroupBoxDemoCtl()
{
InitializeComponent();
}
}
}