feat: introduce Small class and IsReadOnly property.

This commit is contained in:
rabbitism
2024-03-05 16:47:33 +08:00
parent 2790066333
commit fdc6b2e156
7 changed files with 138 additions and 17 deletions

View File

@@ -19,17 +19,20 @@
<ItemsPresenter ItemsPanel="{TemplateBinding ItemsPanel}" />
</ControlTemplate>
</Setter>
<Style Selector="^[IsReadOnly=True]">
<Setter Property="ItemContainerTheme" Value="{DynamicResource ReadOnlyBreadcrumbItem}"></Setter>
</Style>
</ControlTheme>
<ControlTheme x:Key="{x:Type u:BreadcrumbItem}" TargetType="u:BreadcrumbItem">
<Setter Property="Cursor" Value="Hand"></Setter>
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<ControlTemplate TargetType="u:BreadcrumbItem">
<Border Background="Transparent">
<StackPanel Orientation="Horizontal">
<ContentPresenter
Name="PART_IconPresenter"
Margin="0 0 4 0"
Margin="0,0,4,0"
VerticalAlignment="Center"
Content="{TemplateBinding Icon}"
ContentTemplate="{TemplateBinding IconTemplate}"
@@ -39,14 +42,19 @@
<ContentPresenter
Name="PART_ContentPresenter"
VerticalAlignment="Center"
IsVisible="{TemplateBinding Content,
Converter={x:Static ObjectConverters.IsNotNull}}"
Foreground="{DynamicResource SemiColorText2}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}" />
<ContentPresenter Name="Separator" VerticalAlignment="Center" Content="{TemplateBinding Separator}" Foreground="{DynamicResource SemiColorText3}" Margin="4 0">
ContentTemplate="{TemplateBinding ContentTemplate}"
Foreground="{DynamicResource SemiColorText2}"
IsVisible="{TemplateBinding Content,
Converter={x:Static ObjectConverters.IsNotNull}}" />
<ContentPresenter
Name="Separator"
Margin="4,0 0 0"
VerticalAlignment="Center"
Content="{TemplateBinding Separator}"
Foreground="{DynamicResource SemiColorText3}">
<ContentPresenter.IsVisible>
<TemplateBinding Property="Separator" Converter="{x:Static ObjectConverters.IsNotNull}" />
<TemplateBinding Converter="{x:Static ObjectConverters.IsNotNull}" Property="Separator" />
</ContentPresenter.IsVisible>
</ContentPresenter>
</StackPanel>
@@ -55,30 +63,81 @@
</Setter>
<Style Selector="^:last">
<Style Selector="^ /template/ ContentPresenter#PART_IconPresenter">
<Setter Property="Foreground" Value="{DynamicResource SemiColorText0}"/>
<Setter Property="Foreground" Value="{DynamicResource SemiColorText0}" />
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource SemiColorText0}"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Foreground" Value="{DynamicResource SemiColorText0}" />
<Setter Property="FontWeight" Value="Bold" />
</Style>
<Style Selector="^ /template/ ContentPresenter#Separator">
<Setter Property="IsVisible" Value="False"/>
<Setter Property="IsVisible" Value="False" />
</Style>
<Style Selector="^:pointerover">
<Style Selector="^ /template/ ContentPresenter#PART_IconPresenter">
<Setter Property="Foreground" Value="{DynamicResource SemiBlue5}"/>
<Setter Property="Foreground" Value="{DynamicResource SemiBlue5}" />
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource SemiBlue5}"/>
<Setter Property="Foreground" Value="{DynamicResource SemiBlue5}" />
</Style>
</Style>
</Style>
<Style Selector="^:pointerover">
<Style Selector="^ /template/ ContentPresenter#PART_IconPresenter">
<Setter Property="Foreground" Value="{DynamicResource SemiBlue5}"/>
<Setter Property="Foreground" Value="{DynamicResource SemiBlue5}" />
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource SemiBlue5}"/>
<Setter Property="Foreground" Value="{DynamicResource SemiBlue5}" />
</Style>
</Style>
</ControlTheme>
<ControlTheme x:Key="ReadOnlyBreadcrumbItem" TargetType="u:BreadcrumbItem">
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<ControlTemplate TargetType="u:BreadcrumbItem">
<Border Background="Transparent">
<StackPanel Orientation="Horizontal">
<ContentPresenter
Name="PART_IconPresenter"
Margin="0,0,4,0"
VerticalAlignment="Center"
Content="{TemplateBinding Icon}"
ContentTemplate="{TemplateBinding IconTemplate}"
Foreground="{DynamicResource SemiColorText2}"
IsVisible="{TemplateBinding Icon,
Converter={x:Static ObjectConverters.IsNotNull}}" />
<ContentPresenter
Name="PART_ContentPresenter"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Foreground="{DynamicResource SemiColorText2}"
IsVisible="{TemplateBinding Content,
Converter={x:Static ObjectConverters.IsNotNull}}" />
<ContentPresenter
Name="Separator"
Margin="4,0 0 0"
VerticalAlignment="Center"
Content="{TemplateBinding Separator}"
Foreground="{DynamicResource SemiColorText3}">
<ContentPresenter.IsVisible>
<TemplateBinding Converter="{x:Static ObjectConverters.IsNotNull}" Property="Separator" />
</ContentPresenter.IsVisible>
</ContentPresenter>
</StackPanel>
</Border>
</ControlTemplate>
</Setter>
<Style Selector="^:last">
<Style Selector="^ /template/ ContentPresenter#PART_IconPresenter">
<Setter Property="Foreground" Value="{DynamicResource SemiColorText0}" />
</Style>
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
<Setter Property="Foreground" Value="{DynamicResource SemiColorText0}" />
<Setter Property="FontWeight" Value="Bold" />
</Style>
<Style Selector="^ /template/ ContentPresenter#Separator">
<Setter Property="IsVisible" Value="False" />
</Style>
</Style>
</ControlTheme>