feat(style): add TreeView small style

This commit is contained in:
NaBian committed 2021-11-28 13:42:52 +08:00
1 parent ab11cb6456
commit 004cb69877
6 files changed
+53 -16

No files matched your search

@@ -36,13 +36,14 @@
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Padding" Value="10,0"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TreeViewItem">
<Grid>
<Grid.RowDefinitions>
<RowDefinition MinHeight="{StaticResource DefaultControlHeight}"/>
<RowDefinition/>
<RowDefinition MinHeight="{TemplateBinding MinHeight}"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Border x:Name="Bd" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
<DockPanel LastChildFill="True" Margin="{Binding Converter={StaticResource TreeViewItemMarginConverter}, RelativeSource={RelativeSource TemplatedParent}}">
@@ -11535,13 +11535,14 @@
<Setter Property="Background" Value="Transparent" />
<Setter Property="Padding" Value="10,0" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TreeViewItem">
<Grid>
<Grid.RowDefinitions>
<RowDefinition MinHeight="{StaticResource DefaultControlHeight}" />
<RowDefinition />
<RowDefinition MinHeight="{TemplateBinding MinHeight}" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Border x:Name="Bd" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
<DockPanel LastChildFill="True" Margin="{Binding Converter={StaticResource TreeViewItemMarginConverter}, RelativeSource={RelativeSource TemplatedParent}}">
@@ -13269,6 +13270,13 @@
<Style BasedOn="{StaticResource TransferBaseStyle}" TargetType="hc:Transfer" />
<Style BasedOn="{StaticResource TreeViewItemBaseStyle}" TargetType="TreeViewItem" />
<Style BasedOn="{StaticResource TreeViewBaseStyle}" TargetType="TreeView" />
<Style x:Key="TreeViewItemBaseStyle.Small" BasedOn="{StaticResource TreeViewItemBaseStyle}" TargetType="TreeViewItem">
<Setter Property="Padding" Value="6,0" />
<Setter Property="MinHeight" Value="24" />
</Style>
<Style x:Key="TreeView.Small" BasedOn="{StaticResource TreeViewBaseStyle}" TargetType="TreeView">
<Setter Property="ItemContainerStyle" Value="{StaticResource TreeViewItemBaseStyle.Small}" />
</Style>
<Style BasedOn="{StaticResource WatermarkBaseStyle}" TargetType="hc:Watermark" />
<Style BasedOn="{StaticResource AutoCompleteTextBoxBaseStyle}" TargetType="hc:AutoCompleteTextBox" />
<ControlTemplate x:Key="TipSliderThumbHorizontalTop" TargetType="Thumb">
@@ -4,12 +4,21 @@
xmlns:hc="https://handyorg.github.io/handycontrol"
Background="{DynamicResource RegionBrush}">
<hc:TransitioningContentControl>
<TreeView Width="200" Margin="32" ItemsSource="{Binding DataList}">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding DataList}">
<TextBlock Text="{Binding Name}"/>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
<WrapPanel Margin="16">
<TreeView Width="200" Margin="16" ItemsSource="{Binding DataList}">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding DataList}">
<TextBlock Text="{Binding Name}"/>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
<TreeView Width="200" Margin="16" ItemsSource="{Binding DataList}" Style="{StaticResource TreeView.Small}">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding DataList}">
<TextBlock Text="{Binding Name}"/>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
</WrapPanel>
</hc:TransitioningContentControl>
</UserControl>
@@ -36,13 +36,14 @@
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Padding" Value="10,0"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TreeViewItem">
<Grid>
<Grid.RowDefinitions>
<RowDefinition MinHeight="{StaticResource DefaultControlHeight}"/>
<RowDefinition/>
<RowDefinition MinHeight="{TemplateBinding MinHeight}"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Border x:Name="Bd" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
<DockPanel LastChildFill="True" Margin="{Binding Converter={StaticResource TreeViewItemMarginConverter}, RelativeSource={RelativeSource TemplatedParent}}">
@@ -1,7 +1,17 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style BasedOn="{StaticResource TreeViewItemBaseStyle}" TargetType="TreeViewItem"/>
<Style BasedOn="{StaticResource TreeViewBaseStyle}" TargetType="TreeView"/>
<Style x:Key="TreeViewItemBaseStyle.Small" BasedOn="{StaticResource TreeViewItemBaseStyle}" TargetType="TreeViewItem">
<Setter Property="Padding" Value="6,0"/>
<Setter Property="MinHeight" Value="24"/>
</Style>
<Style x:Key="TreeView.Small" BasedOn="{StaticResource TreeViewBaseStyle}" TargetType="TreeView">
<Setter Property="ItemContainerStyle" Value="{StaticResource TreeViewItemBaseStyle.Small}"/>
</Style>
</ResourceDictionary>
@@ -11653,13 +11653,14 @@
<Setter Property="Background" Value="Transparent" />
<Setter Property="Padding" Value="10,0" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TreeViewItem">
<Grid>
<Grid.RowDefinitions>
<RowDefinition MinHeight="{StaticResource DefaultControlHeight}" />
<RowDefinition />
<RowDefinition MinHeight="{TemplateBinding MinHeight}" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Border x:Name="Bd" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
<DockPanel LastChildFill="True" Margin="{Binding Converter={StaticResource TreeViewItemMarginConverter}, RelativeSource={RelativeSource TemplatedParent}}">
@@ -13420,6 +13421,13 @@
<Style BasedOn="{StaticResource TransferBaseStyle}" TargetType="hc:Transfer" />
<Style BasedOn="{StaticResource TreeViewItemBaseStyle}" TargetType="TreeViewItem" />
<Style BasedOn="{StaticResource TreeViewBaseStyle}" TargetType="TreeView" />
<Style x:Key="TreeViewItemBaseStyle.Small" BasedOn="{StaticResource TreeViewItemBaseStyle}" TargetType="TreeViewItem">
<Setter Property="Padding" Value="6,0" />
<Setter Property="MinHeight" Value="24" />
</Style>
<Style x:Key="TreeView.Small" BasedOn="{StaticResource TreeViewBaseStyle}" TargetType="TreeView">
<Setter Property="ItemContainerStyle" Value="{StaticResource TreeViewItemBaseStyle.Small}" />
</Style>
<Style BasedOn="{StaticResource WatermarkBaseStyle}" TargetType="hc:Watermark" />
<Style BasedOn="{StaticResource AutoCompleteTextBoxBaseStyle}" TargetType="hc:AutoCompleteTextBox" />
<ControlTemplate x:Key="TipSliderThumbHorizontalTop" TargetType="Thumb">