improved the pr

This commit is contained in:
NaBian 2019-04-20 00:33:12 +08:00
parent 287bf7c6a2
commit c2db3fbfc0
13 changed files with 356 additions and 19 deletions

View File

@ -17,4 +17,7 @@
<DocumentationFile>C:\Code\GitHub\HandyControl\src\Core_30\HandyControl_Core_30\HandyControl.xml</DocumentationFile> <DocumentationFile>C:\Code\GitHub\HandyControl\src\Core_30\HandyControl_Core_30\HandyControl.xml</DocumentationFile>
</PropertyGroup> </PropertyGroup>
<Import Project="..\..\Shared\HandyControl_Shared\HandyControl_Shared.projitems" Label="Shared" /> <Import Project="..\..\Shared\HandyControl_Shared\HandyControl_Shared.projitems" Label="Shared" />
<ItemGroup>
<None Remove="Themes\Styles\Base\TreeViewBaseStyle.xaml" />
</ItemGroup>
</Project> </Project>

View File

@ -0,0 +1,142 @@
<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="../../Basic/Converters.xaml"/>
<ResourceDictionary Source="BaseStyle.xaml"/>
<ResourceDictionary Source="ScrollViewerBaseStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
<PathGeometry x:Key="TreeArrow" Figures="M508.893248 762.931659a65.039498 65.039498 0 0 1-46.420659-19.485839L97.125746 371.004022c-25.143018-25.634319-24.752868-66.816849 0.881451-91.959868 25.648769-25.164693 66.809624-24.745643 91.959867 0.881451l318.933409 325.125238 318.933408-325.125238a65.025048 65.025048 0 0 1 92.841318 91.078417L555.313907 743.44582a65.025048 65.025048 0 0 1-46.420659 19.485839z"/>
<Style x:Key="ExpandCollapseToggleStyle" TargetType="ToggleButton">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Width" Value="16"/>
<Setter Property="Height" Value="16"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border Background="Transparent" Height="16" Padding="4" Width="16">
<Path x:Name="ExpandPath" RenderTransformOrigin="0.5,0.5" Stretch="Uniform" Data="{StaticResource TreeArrow}" Fill="{Binding Foreground, RelativeSource={RelativeSource AncestorType=TreeViewItem}}">
<Path.RenderTransform>
<RotateTransform Angle="-90"/>
</Path.RenderTransform>
</Path>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="RenderTransform" TargetName="ExpandPath">
<Setter.Value>
<RotateTransform Angle="0"/>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="TreeViewItemBaseStyle" TargetType="TreeViewItem">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Padding" Value="10,0"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TreeViewItem">
<Grid>
<Grid.RowDefinitions>
<RowDefinition MinHeight="32"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
<StackPanel Orientation="Horizontal" Margin="{Binding Converter={StaticResource TreeViewItemMarginConverter}, RelativeSource={RelativeSource AncestorLevel=1, AncestorType=TreeViewItem}}">
<ToggleButton x:Name="Expander" ClickMode="Press" IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ExpandCollapseToggleStyle}"/>
<ContentPresenter VerticalAlignment="Center" x:Name="PART_Header" ContentSource="Header" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</StackPanel>
</Border>
<ItemsPresenter x:Name="ItemsHost" Grid.Row="1"/>
</Grid>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="true"/>
<Condition Property="HasItems" Value="false"/>
</MultiTrigger.Conditions>
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource SecondaryRegionBrush}"/>
</MultiTrigger>
<Trigger Property="IsExpanded" Value="false">
<Setter Property="Visibility" TargetName="ItemsHost" Value="Collapsed"/>
</Trigger>
<Trigger Property="HasItems" Value="false">
<Setter Property="Visibility" TargetName="Expander" Value="Hidden"/>
</Trigger>
<Trigger Property="IsSelected" Value="true">
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource PrimaryBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"/>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="true"/>
<Condition Property="IsSelectionActive" Value="false"/>
</MultiTrigger.Conditions>
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource DarkDefaultBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
</MultiTrigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="{StaticResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="TreeViewBaseStyle" TargetType="TreeView" BasedOn="{StaticResource BaseStyle}">
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.PanningMode" Value="Both"/>
<Setter Property="controls:ScrollViewer.IsEnableInertia" Value="False"/>
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="VirtualizingPanel.IsVirtualizing" Value="True"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TreeView">
<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true">
<controls:ScrollViewer x:Name="_tv_scrollviewer_" IsEnableInertia="{Binding Path=(controls:ScrollViewer.IsEnableInertia),RelativeSource={RelativeSource TemplatedParent}}" Template="{StaticResource ScrollViewerBaseControlTemplate}" Background="{TemplateBinding Background}" CanContentScroll="false" Focusable="false" HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
<ItemsPresenter/>
</controls:ScrollViewer>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Background" TargetName="Bd" Value="{StaticResource {x:Static SystemColors.ControlBrushKey}}"/>
</Trigger>
<Trigger Property="VirtualizingPanel.IsVirtualizing" Value="true">
<Setter Property="CanContentScroll" TargetName="_tv_scrollviewer_" Value="true"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="VirtualizingPanel.IsVirtualizing" Value="true">
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<VirtualizingStackPanel/>
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>

View File

@ -49,6 +49,10 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>XamlIntelliSenseFileGenerator</Generator> <Generator>XamlIntelliSenseFileGenerator</Generator>
</Page> </Page>
<Page Include="Themes\Styles\Base\TreeViewBaseStyle.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Themes\Styles\DataGrid.xaml"> <Page Include="Themes\Styles\DataGrid.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>XamlIntelliSenseFileGenerator</Generator> <Generator>XamlIntelliSenseFileGenerator</Generator>

View File

@ -49,7 +49,7 @@
<ControlTemplate TargetType="TreeViewItem"> <ControlTemplate TargetType="TreeViewItem">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="32"/> <RowDefinition MinHeight="32"/>
<RowDefinition/> <RowDefinition/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true"> <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
@ -106,7 +106,7 @@
<Setter Property="controls:ScrollViewer.IsEnableInertia" Value="False"/> <Setter Property="controls:ScrollViewer.IsEnableInertia" Value="False"/>
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/> <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
<Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="VerticalContentAlignment" Value="Center"/>
<!--<Setter Property="VirtualizingPanel.IsVirtualizing" Value="True"/>--> <Setter Property="VirtualizingPanel.IsVirtualizing" Value="True"/>
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="TreeView"> <ControlTemplate TargetType="TreeView">

View File

@ -95,6 +95,10 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>XamlIntelliSenseFileGenerator</Generator> <Generator>XamlIntelliSenseFileGenerator</Generator>
</Page> </Page>
<Page Include="Themes\Styles\Base\TreeViewBaseStyle.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Themes\Styles\DataGrid.xaml"> <Page Include="Themes\Styles\DataGrid.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>XamlIntelliSenseFileGenerator</Generator> <Generator>XamlIntelliSenseFileGenerator</Generator>

View File

@ -0,0 +1,142 @@
<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="../../Basic/Converters.xaml"/>
<ResourceDictionary Source="BaseStyle.xaml"/>
<ResourceDictionary Source="ScrollViewerBaseStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
<PathGeometry x:Key="TreeArrow" Figures="M508.893248 762.931659a65.039498 65.039498 0 0 1-46.420659-19.485839L97.125746 371.004022c-25.143018-25.634319-24.752868-66.816849 0.881451-91.959868 25.648769-25.164693 66.809624-24.745643 91.959867 0.881451l318.933409 325.125238 318.933408-325.125238a65.025048 65.025048 0 0 1 92.841318 91.078417L555.313907 743.44582a65.025048 65.025048 0 0 1-46.420659 19.485839z"/>
<Style x:Key="ExpandCollapseToggleStyle" TargetType="ToggleButton">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Width" Value="16"/>
<Setter Property="Height" Value="16"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border Background="Transparent" Height="16" Padding="4" Width="16">
<Path x:Name="ExpandPath" RenderTransformOrigin="0.5,0.5" Stretch="Uniform" Data="{StaticResource TreeArrow}" Fill="{Binding Foreground, RelativeSource={RelativeSource AncestorType=TreeViewItem}}">
<Path.RenderTransform>
<RotateTransform Angle="-90"/>
</Path.RenderTransform>
</Path>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="RenderTransform" TargetName="ExpandPath">
<Setter.Value>
<RotateTransform Angle="0"/>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="TreeViewItemBaseStyle" TargetType="TreeViewItem">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Padding" Value="10,0"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TreeViewItem">
<Grid>
<Grid.RowDefinitions>
<RowDefinition MinHeight="32"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
<StackPanel Orientation="Horizontal" Margin="{Binding Converter={StaticResource TreeViewItemMarginConverter}, RelativeSource={RelativeSource AncestorLevel=1, AncestorType=TreeViewItem}}">
<ToggleButton x:Name="Expander" ClickMode="Press" IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ExpandCollapseToggleStyle}"/>
<ContentPresenter VerticalAlignment="Center" x:Name="PART_Header" ContentSource="Header" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</StackPanel>
</Border>
<ItemsPresenter x:Name="ItemsHost" Grid.Row="1"/>
</Grid>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="true"/>
<Condition Property="HasItems" Value="false"/>
</MultiTrigger.Conditions>
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource SecondaryRegionBrush}"/>
</MultiTrigger>
<Trigger Property="IsExpanded" Value="false">
<Setter Property="Visibility" TargetName="ItemsHost" Value="Collapsed"/>
</Trigger>
<Trigger Property="HasItems" Value="false">
<Setter Property="Visibility" TargetName="Expander" Value="Hidden"/>
</Trigger>
<Trigger Property="IsSelected" Value="true">
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource PrimaryBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"/>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsSelected" Value="true"/>
<Condition Property="IsSelectionActive" Value="false"/>
</MultiTrigger.Conditions>
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource DarkDefaultBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
</MultiTrigger>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="{StaticResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="TreeViewBaseStyle" TargetType="TreeView" BasedOn="{StaticResource BaseStyle}">
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="ScrollViewer.PanningMode" Value="Both"/>
<Setter Property="controls:ScrollViewer.IsEnableInertia" Value="False"/>
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="VirtualizingPanel.IsVirtualizing" Value="True"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TreeView">
<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true">
<controls:ScrollViewer x:Name="_tv_scrollviewer_" IsEnableInertia="{Binding Path=(controls:ScrollViewer.IsEnableInertia),RelativeSource={RelativeSource TemplatedParent}}" Template="{StaticResource ScrollViewerBaseControlTemplate}" Background="{TemplateBinding Background}" CanContentScroll="false" Focusable="false" HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
<ItemsPresenter/>
</controls:ScrollViewer>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Background" TargetName="Bd" Value="{StaticResource {x:Static SystemColors.ControlBrushKey}}"/>
</Trigger>
<Trigger Property="VirtualizingPanel.IsVirtualizing" Value="true">
<Setter Property="CanContentScroll" TargetName="_tv_scrollviewer_" Value="true"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="VirtualizingPanel.IsVirtualizing" Value="true">
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<VirtualizingStackPanel/>
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>

View File

@ -46,7 +46,7 @@
<MultiDataTrigger> <MultiDataTrigger>
<MultiDataTrigger.Conditions> <MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsSelected,RelativeSource={RelativeSource Self}}" Value="true"/> <Condition Binding="{Binding IsSelected,RelativeSource={RelativeSource Self}}" Value="true"/>
<Condition Binding="{Binding SelectionUnit,RelativeSource={RelativeSource FindAncestor,AncestorType=DataGrid}}" Value="Cell"/> <Condition Binding="{Binding SelectionUnit,RelativeSource={RelativeSource AncestorType=DataGrid}}" Value="Cell"/>
</MultiDataTrigger.Conditions> </MultiDataTrigger.Conditions>
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"/> <Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"/>
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}"/> <Setter Property="Background" Value="{DynamicResource PrimaryBrush}"/>
@ -55,7 +55,7 @@
<MultiDataTrigger.Conditions> <MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsSelected,RelativeSource={RelativeSource Self}}" Value="true"/> <Condition Binding="{Binding IsSelected,RelativeSource={RelativeSource Self}}" Value="true"/>
<Condition Binding="{Binding IsSelected,RelativeSource={RelativeSource AncestorType=DataGridRow}}" Value="False"/> <Condition Binding="{Binding IsSelected,RelativeSource={RelativeSource AncestorType=DataGridRow}}" Value="False"/>
<Condition Binding="{Binding SelectionUnit,RelativeSource={RelativeSource FindAncestor,AncestorType=DataGrid}}" Value="CellOrRowHeader"/> <Condition Binding="{Binding SelectionUnit,RelativeSource={RelativeSource AncestorType=DataGrid}}" Value="CellOrRowHeader"/>
</MultiDataTrigger.Conditions> </MultiDataTrigger.Conditions>
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"/> <Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"/>
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}"/> <Setter Property="Background" Value="{DynamicResource PrimaryBrush}"/>
@ -64,14 +64,14 @@
<MultiDataTrigger.Conditions> <MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsSelected,RelativeSource={RelativeSource Self}}" Value="true"/> <Condition Binding="{Binding IsSelected,RelativeSource={RelativeSource Self}}" Value="true"/>
<Condition Binding="{Binding IsSelected,RelativeSource={RelativeSource AncestorType=DataGridRow}}" Value="True"/> <Condition Binding="{Binding IsSelected,RelativeSource={RelativeSource AncestorType=DataGridRow}}" Value="True"/>
<Condition Binding="{Binding SelectionUnit,RelativeSource={RelativeSource FindAncestor,AncestorType=DataGrid}}" Value="CellOrRowHeader"/> <Condition Binding="{Binding SelectionUnit,RelativeSource={RelativeSource AncestorType=DataGrid}}" Value="CellOrRowHeader"/>
</MultiDataTrigger.Conditions> </MultiDataTrigger.Conditions>
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"/> <Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"/>
</MultiDataTrigger> </MultiDataTrigger>
<MultiDataTrigger> <MultiDataTrigger>
<MultiDataTrigger.Conditions> <MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsSelected,RelativeSource={RelativeSource Self}}" Value="true"/> <Condition Binding="{Binding IsSelected,RelativeSource={RelativeSource Self}}" Value="true"/>
<Condition Binding="{Binding SelectionUnit,RelativeSource={RelativeSource FindAncestor,AncestorType=DataGrid}}" Value="FullRow"/> <Condition Binding="{Binding SelectionUnit,RelativeSource={RelativeSource AncestorType=DataGrid}}" Value="FullRow"/>
</MultiDataTrigger.Conditions> </MultiDataTrigger.Conditions>
<Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"/> <Setter Property="Foreground" Value="{DynamicResource TextIconBrush}"/>
</MultiDataTrigger> </MultiDataTrigger>

View File

@ -91,7 +91,7 @@
</Border> </Border>
</TabItem> </TabItem>
</TabControl> </TabControl>
<TabControl Margin="16" Width="400" Height="200" Style="{StaticResource TabControlCapsule}"> <TabControl TabStripPlacement="Left" Margin="16" Width="400" Height="200" Style="{StaticResource TabControlCapsule}">
<TabItem Header="{x:Static langs:Lang.Title}" HeaderStringFormat="{}{0}1"> <TabItem Header="{x:Static langs:Lang.Title}" HeaderStringFormat="{}{0}1">
<Border Background="{DynamicResource PrimaryBrush}"> <Border Background="{DynamicResource PrimaryBrush}">
<TextBlock Style="{StaticResource TextBlockLargeBold}" Foreground="{DynamicResource TextIconBrush}"> <TextBlock Style="{StaticResource TextBlockLargeBold}" Foreground="{DynamicResource TextIconBrush}">
@ -133,7 +133,7 @@
</Border> </Border>
</TabItem> </TabItem>
</TabControl> </TabControl>
<TabControl Margin="16" Width="400" Height="200" Style="{StaticResource TabControlCapsuleSolid}"> <TabControl TabStripPlacement="Bottom" Margin="16" Width="400" Height="200" Style="{StaticResource TabControlCapsuleSolid}">
<TabItem Header="{x:Static langs:Lang.Title}" HeaderStringFormat="{}{0}1"> <TabItem Header="{x:Static langs:Lang.Title}" HeaderStringFormat="{}{0}1">
<Border Background="{DynamicResource PrimaryBrush}"> <Border Background="{DynamicResource PrimaryBrush}">
<TextBlock Style="{StaticResource TextBlockLargeBold}" Foreground="{DynamicResource TextIconBrush}"> <TextBlock Style="{StaticResource TextBlockLargeBold}" Foreground="{DynamicResource TextIconBrush}">

View File

@ -474,10 +474,6 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\Base\TreeViewBaseStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\Border.xaml"> <Page Include="$(MSBuildThisFileDirectory)Themes\Styles\Border.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>

View File

@ -8,7 +8,7 @@
<Setter Property="FocusVisualStyle" Value="{x:Null}"/> <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Padding" Value="10,0"/> <Setter Property="Padding" Value="10,0"/>
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/> <Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
<Setter Property="Height" Value="32"/> <Setter Property="MinHeight" Value="32"/>
<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType=ItemsControl}}"/> <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType=ItemsControl}}"/>
<Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/> <Setter Property="Background" Value="{DynamicResource RegionBrush}"/>

View File

@ -157,6 +157,12 @@
<Setter Property="Background" Value="{Binding Path=(controls:TitleElement.Background),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"/> <Setter Property="TextElement.Foreground" Value="{Binding Path=(controls:TitleElement.Foreground),RelativeSource={RelativeSource TemplatedParent}}" TargetName="contentPresenter"/>
</Trigger> </Trigger>
<DataTrigger Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource AncestorType=TabControl}}" Value="Left">
<Setter Property="Margin" Value="0,-1,0,0"/>
</DataTrigger>
<DataTrigger Binding="{Binding TabStripPlacement, RelativeSource={RelativeSource AncestorType=TabControl}}" Value="Right">
<Setter Property="Margin" Value="0,-1,0,0"/>
</DataTrigger>
</ControlTemplate.Triggers> </ControlTemplate.Triggers>
</ControlTemplate> </ControlTemplate>
</Setter.Value> </Setter.Value>

View File

@ -155,11 +155,11 @@
<Setter TargetName="RowDefinition1" Property="Height" Value="0" /> <Setter TargetName="RowDefinition1" Property="Height" Value="0" />
<Setter TargetName="ColumnDefinition0" Property="Width" Value="Auto" /> <Setter TargetName="ColumnDefinition0" Property="Width" Value="Auto" />
<Setter TargetName="ColumnDefinition1" Property="Width" Value="*" /> <Setter TargetName="ColumnDefinition1" Property="Width" Value="*" />
<Setter TargetName="headerPanel" Property="Grid.Column" Value="0" />
<Setter TargetName="headerPanel" Property="Grid.Row" Value="0" />
<Setter TargetName="contentPanel" Property="Grid.Column" Value="1" /> <Setter TargetName="contentPanel" Property="Grid.Column" Value="1" />
<Setter TargetName="contentPanel" Property="Grid.Row" Value="0" /> <Setter TargetName="contentPanel" Property="Grid.Row" Value="0" />
<Setter TargetName="contentPanel" Property="BorderThickness" Value="1,0,0,0"/> <Setter TargetName="contentPanel" Property="BorderThickness" Value="1,0,0,0"/>
<Setter TargetName="headerPanel" Property="Grid.Column" Value="0" />
<Setter TargetName="headerPanel" Property="Grid.Row" Value="0" />
<Setter TargetName="headerPanel" Property="Rows" Value="0"/> <Setter TargetName="headerPanel" Property="Rows" Value="0"/>
<Setter TargetName="headerPanel" Property="Columns" Value="1"/> <Setter TargetName="headerPanel" Property="Columns" Value="1"/>
</Trigger> </Trigger>
@ -227,11 +227,46 @@
<RowDefinition x:Name="RowDefinition0" Height="Auto"/> <RowDefinition x:Name="RowDefinition0" Height="Auto"/>
<RowDefinition x:Name="RowDefinition1" Height="*"/> <RowDefinition x:Name="RowDefinition1" Height="*"/>
</Grid.RowDefinitions> </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"/> <UniformGrid Rows="1" HorizontalAlignment="Center" VerticalAlignment="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"> <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}"/> <ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" Margin="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Border> </Border>
</Grid> </Grid>
<ControlTemplate.Triggers>
<Trigger Property="TabStripPlacement" Value="Bottom">
<Setter TargetName="RowDefinition0" Property="Height" Value="*"/>
<Setter TargetName="RowDefinition1" Property="Height" Value="Auto"/>
<Setter TargetName="headerPanel" Property="Grid.Row" Value="1"/>
<Setter TargetName="contentPanel" Property="Margin" Value="0,0,0,6"/>
<Setter TargetName="contentPanel" Property="Grid.Row" Value="0"/>
</Trigger>
<Trigger Property="TabStripPlacement" Value="Left">
<Setter TargetName="RowDefinition0" Property="Height" Value="*" />
<Setter TargetName="RowDefinition1" Property="Height" Value="0" />
<Setter TargetName="ColumnDefinition0" Property="Width" Value="Auto" />
<Setter TargetName="ColumnDefinition1" Property="Width" Value="*" />
<Setter TargetName="headerPanel" Property="Grid.Column" Value="0" />
<Setter TargetName="headerPanel" Property="Grid.Row" Value="0" />
<Setter TargetName="headerPanel" Property="Rows" Value="0"/>
<Setter TargetName="headerPanel" Property="Columns" Value="1"/>
<Setter TargetName="contentPanel" Property="Grid.Column" Value="1" />
<Setter TargetName="contentPanel" Property="Grid.Row" Value="0" />
<Setter TargetName="contentPanel" Property="Margin" Value="6,0,0,0"/>
</Trigger>
<Trigger Property="TabStripPlacement" Value="Right">
<Setter TargetName="RowDefinition0" Property="Height" Value="*" />
<Setter TargetName="RowDefinition1" Property="Height" Value="0" />
<Setter TargetName="ColumnDefinition0" Property="Width" Value="*" />
<Setter TargetName="ColumnDefinition1" Property="Width" Value="Auto" />
<Setter TargetName="headerPanel" Property="Grid.Column" Value="1" />
<Setter TargetName="headerPanel" Property="Grid.Row" Value="0" />
<Setter TargetName="headerPanel" Property="Rows" Value="0"/>
<Setter TargetName="headerPanel" Property="Columns" Value="1"/>
<Setter TargetName="contentPanel" Property="Grid.Column" Value="0" />
<Setter TargetName="contentPanel" Property="Grid.Row" Value="0" />
<Setter TargetName="contentPanel" Property="Margin" Value="0,0,6,0"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate> </ControlTemplate>
</Setter.Value> </Setter.Value>
</Setter> </Setter>

View File

@ -18,9 +18,14 @@ namespace HandyControl.Tools
var index = tabControl.Items.IndexOf(tabItem); var index = tabControl.Items.IndexOf(tabItem);
return index == 0 return index == 0
? ResourceHelper.GetResource<Style>(ResourceToken.TabItemCapsuleHorizontalFirst) ? ResourceHelper.GetResource<Style>(
tabControl.TabStripPlacement == Dock.Top || tabControl.TabStripPlacement == Dock.Bottom
? ResourceToken.TabItemCapsuleHorizontalFirst
: ResourceToken.TabItemCapsuleVerticalFirst)
: ResourceHelper.GetResource<Style>(index == count - 1 : ResourceHelper.GetResource<Style>(index == count - 1
? ResourceToken.TabItemCapsuleHorizontalLast ? tabControl.TabStripPlacement == Dock.Top || tabControl.TabStripPlacement == Dock.Bottom
? ResourceToken.TabItemCapsuleHorizontalLast
: ResourceToken.TabItemCapsuleVerticalLast
: ResourceToken.TabItemCapsuleDefault); : ResourceToken.TabItemCapsuleDefault);
} }