add new tabcontrol style and radiobutton style
This commit is contained in:
1 parent
fb202f0e0a
commit
4eb8b828b4
27 files changed
+620
-40
No files matched your search
@@ -1,5 +1,11 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../../Basic/Sizes.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style x:Key="RadioButtonBaseStyle" TargetType="RadioButton">
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||
@@ -88,4 +94,49 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="RadioGroupItemBaseStyle" TargetType="RadioButton">
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||
<Setter Property="Background" Value="{DynamicResource DefaultBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="0"/>
|
||||
<Setter Property="Height" Value="{StaticResource DefaultControlHeight}"/>
|
||||
<Setter Property="Padding" Value="10,0"/>
|
||||
<Setter Property="Margin" Value="-1,0,0,0"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="RadioButton">
|
||||
<Border x:Name="BorderRoot" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
|
||||
<ContentPresenter x:Name="contentPresenter" TextElement.Foreground="{TemplateBinding Foreground}" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="TextElement.Foreground" Value="{DynamicResource PrimaryBrush}" TargetName="contentPresenter"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsChecked" Value="true">
|
||||
<Setter Property="BorderBrush" Value="{Binding Path=(controls:TitleElement.BorderBrush),RelativeSource={RelativeSource TemplatedParent}}" TargetName="BorderRoot"/>
|
||||
<Setter Property="Background" Value="{Binding Path=(controls:TitleElement.Background),RelativeSource={RelativeSource TemplatedParent}}" TargetName="BorderRoot"/>
|
||||
<Setter Property="TextElement.Foreground" Value="{Binding Path=(controls:TitleElement.Foreground),RelativeSource={RelativeSource TemplatedParent}}" TargetName="contentPresenter"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Opacity" Value="0.4"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter Property="Panel.ZIndex" Value="{x:Static system:Int32.MaxValue}"/>
|
||||
</Trigger>
|
||||
<DataTrigger Binding="{Binding Orientation,RelativeSource={RelativeSource FindAncestor, AncestorType=controls:RadioGroup}}" Value="Vertical">
|
||||
<Setter Property="Margin" Value="0,-1,0,0"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,26 @@
|
||||
<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"
|
||||
xmlns:tools="clr-namespace:HandyControl.Tools">
|
||||
|
||||
<ItemsPanelTemplate x:Key="RadioGroupHorizontalItemsPanelTemplate">
|
||||
<UniformGrid FocusVisualStyle="{x:Null}" Rows="1"/>
|
||||
</ItemsPanelTemplate>
|
||||
|
||||
<ItemsPanelTemplate x:Key="RadioGroupVerticalItemsPanelTemplate">
|
||||
<UniformGrid FocusVisualStyle="{x:Null}" Columns="1"/>
|
||||
</ItemsPanelTemplate>
|
||||
|
||||
<Style x:Key="RadioGroupBaseStyle" TargetType="controls:RadioGroup">
|
||||
<Setter Property="ItemsPanel" Value="{StaticResource RadioGroupHorizontalItemsPanelTemplate}"/>
|
||||
<Setter Property="controls:TitleElement.BorderBrush" Value="{DynamicResource PrimaryBrush}"/>
|
||||
<Setter Property="controls:TitleElement.Background" Value="{DynamicResource DefaultBrush}"/>
|
||||
<Setter Property="controls:TitleElement.Foreground" Value="{DynamicResource PrimaryBrush}"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="Orientation" Value="Vertical">
|
||||
<Setter Property="ItemsPanel" Value="{StaticResource RadioGroupVerticalItemsPanelTemplate}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -1,5 +1,11 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../../Basic/Sizes.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style x:Key="TabItemStyle" TargetType="TabItem">
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||
@@ -70,4 +76,41 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="TabItemCapsuleBaseStyle" TargetType="TabItem">
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
|
||||
<Setter Property="Background" Value="{DynamicResource DefaultBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="0"/>
|
||||
<Setter Property="Height" Value="{StaticResource DefaultControlHeight}"/>
|
||||
<Setter Property="Padding" Value="10,0"/>
|
||||
<Setter Property="Margin" Value="-1,0,0,0"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="TabItem">
|
||||
<Border x:Name="BorderRoot" CornerRadius="{Binding Path=(controls:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
|
||||
<ContentPresenter x:Name="contentPresenter" ContentSource="Header" TextElement.Foreground="{TemplateBinding Foreground}" Focusable="False" HorizontalAlignment="Center" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="TextElement.Foreground" Value="{DynamicResource PrimaryBrush}" TargetName="contentPresenter"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="true">
|
||||
<Setter Property="BorderBrush" Value="{Binding Path=(controls:TitleElement.BorderBrush),RelativeSource={RelativeSource TemplatedParent}}" TargetName="BorderRoot"/>
|
||||
<Setter Property="Background" Value="{Binding Path=(controls:TitleElement.Background),RelativeSource={RelativeSource TemplatedParent}}" TargetName="BorderRoot"/>
|
||||
<Setter Property="TextElement.Foreground" Value="{Binding Path=(controls:TitleElement.Foreground),RelativeSource={RelativeSource TemplatedParent}}" TargetName="contentPresenter"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Panel.ZIndex" Value="{x:Static system:Int32.MaxValue}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -1,5 +1,6 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Base/RadioButtonBaseStyle.xaml"/>
|
||||
@@ -10,4 +11,28 @@
|
||||
|
||||
<Style x:Key="RadioButtonCustom" BasedOn="{StaticResource ToggleButtonCustom}" TargetType="RadioButton"/>
|
||||
|
||||
<Style x:Key="RadioGroupItemDefault" BasedOn="{StaticResource RadioGroupItemBaseStyle}" TargetType="RadioButton"/>
|
||||
|
||||
<Style x:Key="RadioGroupItemHorizontalFirst" BasedOn="{StaticResource RadioGroupItemBaseStyle}" TargetType="RadioButton">
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="4,0,0,4"/>
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="RadioGroupItemHorizontalLast" BasedOn="{StaticResource RadioGroupItemBaseStyle}" TargetType="RadioButton">
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="0,4,4,0"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="RadioGroupItemSingle" BasedOn="{StaticResource RadioGroupItemBaseStyle}" TargetType="RadioButton">
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="4"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="RadioGroupItemVerticalFirst" BasedOn="{StaticResource RadioGroupItemBaseStyle}" TargetType="RadioButton">
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="4,4,0,0"/>
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="RadioGroupItemVerticalLast" BasedOn="{StaticResource RadioGroupItemBaseStyle}" TargetType="RadioButton">
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="0,0,4,4"/>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,17 @@
|
||||
<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/RadioGroupBaseStyle.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style BasedOn="{StaticResource RadioGroupBaseStyle}" TargetType="controls:RadioGroup"/>
|
||||
|
||||
<Style x:Key="RadioGroupSolid" BasedOn="{StaticResource RadioGroupBaseStyle}" TargetType="controls:RadioGroup">
|
||||
<Setter Property="controls:TitleElement.BorderBrush" Value="{DynamicResource TitleBrush}"/>
|
||||
<Setter Property="controls:TitleElement.Background" Value="{DynamicResource TitleBrush}"/>
|
||||
<Setter Property="controls:TitleElement.Foreground" Value="{DynamicResource TextIconBrush}"/>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -46,6 +46,7 @@
|
||||
<ResourceDictionary Source="ToolBar.xaml"/>
|
||||
<ResourceDictionary Source="SearchBar.xaml"/>
|
||||
<ResourceDictionary Source="Tag.xaml"/>
|
||||
<ResourceDictionary Source="RadioGroup.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -2,7 +2,8 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls"
|
||||
xmlns:langs="clr-namespace:HandyControl.Properties.Langs"
|
||||
xmlns:interactivity="clr-namespace:HandyControl.Interactivity">
|
||||
xmlns:interactivity="clr-namespace:HandyControl.Interactivity"
|
||||
xmlns:tools="clr-namespace:HandyControl.Tools">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../Basic/Paths.xaml"/>
|
||||
@@ -145,4 +146,65 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="TabItemCapsuleDefault" BasedOn="{StaticResource TabItemCapsuleBaseStyle}" TargetType="TabItem"/>
|
||||
|
||||
<Style x:Key="TabItemCapsuleHorizontalFirst" BasedOn="{StaticResource TabItemCapsuleBaseStyle}" TargetType="TabItem">
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="4,0,0,4"/>
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="TabItemCapsuleHorizontalLast" BasedOn="{StaticResource TabItemCapsuleBaseStyle}" TargetType="TabItem">
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="0,4,4,0"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="TabItemCapsuleSingle" BasedOn="{StaticResource TabItemCapsuleBaseStyle}" TargetType="TabItem">
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="4"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="TabItemCapsuleVerticalFirst" BasedOn="{StaticResource TabItemCapsuleBaseStyle}" TargetType="TabItem">
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="4,4,0,0"/>
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="TabItemCapsuleVerticalLast" BasedOn="{StaticResource TabItemCapsuleBaseStyle}" TargetType="TabItem">
|
||||
<Setter Property="controls:BorderElement.CornerRadius" Value="0,0,4,4"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="TabControlCapsule" TargetType="TabControl">
|
||||
<Setter Property="controls:TitleElement.BorderBrush" Value="{DynamicResource PrimaryBrush}"/>
|
||||
<Setter Property="controls:TitleElement.Background" Value="{DynamicResource DefaultBrush}"/>
|
||||
<Setter Property="controls:TitleElement.Foreground" Value="{DynamicResource PrimaryBrush}"/>
|
||||
<Setter Property="ItemContainerStyleSelector">
|
||||
<Setter.Value>
|
||||
<tools:TabItemCapsuleStyleSelector/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="TabControl">
|
||||
<Grid x:Name="templateRoot" Background="{DynamicResource RegionBrush}" ClipToBounds="true" SnapsToDevicePixels="true" KeyboardNavigation.TabNavigation="Local">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition x:Name="ColumnDefinition0"/>
|
||||
<ColumnDefinition x:Name="ColumnDefinition1" Width="0"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition x:Name="RowDefinition0" Height="Auto"/>
|
||||
<RowDefinition x:Name="RowDefinition1" Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<UniformGrid Rows="1" HorizontalAlignment="Center" x:Name="headerPanel" Background="Transparent" Grid.Column="0" IsItemsHost="true" Margin="0" Grid.Row="0" KeyboardNavigation.TabIndex="1" Panel.ZIndex="1"/>
|
||||
<Border x:Name="contentPanel" Margin="0,6,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}" Background="{TemplateBinding Background}" Grid.Column="0" KeyboardNavigation.DirectionalNavigation="Contained" Grid.Row="1" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local">
|
||||
<ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" Margin="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="TabControlCapsuleSolid" BasedOn="{StaticResource TabControlCapsule}" TargetType="TabControl">
|
||||
<Setter Property="controls:TitleElement.BorderBrush" Value="{DynamicResource TitleBrush}"/>
|
||||
<Setter Property="controls:TitleElement.Background" Value="{DynamicResource TitleBrush}"/>
|
||||
<Setter Property="controls:TitleElement.Foreground" Value="{DynamicResource TextIconBrush}"/>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
Reference in new issue
Block a user