Files
Shrlalgo.RvKits/NeuWPF/NeoUI/Controls/Breadcrumb.xaml

117 lines
6.4 KiB
Plaintext
Raw Normal View History

2025-08-12 23:08:54 +08:00
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2025-08-20 12:10:13 +08:00
xmlns:controls="clr-namespace:NeumUI.Controls"
xmlns:converters="clr-namespace:NeumUI.Converters"
2025-08-12 23:08:54 +08:00
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="{x:Type controls:BreadcrumbItem}" x:Key="BreadcrumbItem">
<Setter Property="FocusVisualStyle" Value="{DynamicResource FocusVisual}" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Padding" Value="0" />
<Setter Property="Margin" Value="4" />
<Setter Property="Separator" Value="{Binding Separator, RelativeSource={RelativeSource AncestorType=controls:Breadcrumb}}" />
<Setter Property="SeparatorBrush" Value="{Binding SeparatorBrush, RelativeSource={RelativeSource AncestorType=controls:Breadcrumb}}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:BreadcrumbItem}">
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
x:Name="Bd">
<StackPanel Orientation="Horizontal">
<ContentPresenter
Cursor="Hand"
Margin="{TemplateBinding Padding}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
x:Name="content" />
<TextBlock
Foreground="{TemplateBinding SeparatorBrush}"
Margin="{TemplateBinding Padding}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
Text="{TemplateBinding Separator}"
Visibility="Collapsed"
x:Name="separator" />
<Rectangle
Fill="{TemplateBinding SeparatorBrush}"
Height="2"
Margin="{TemplateBinding Padding}"
RenderTransformOrigin="0.5,0.5"
VerticalAlignment="Center"
Width="20"
x:Name="separatorIcon">
<Rectangle.RenderTransform>
<RotateTransform Angle="105" />
</Rectangle.RenderTransform>
</Rectangle>
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="{DynamicResource PrimaryFocusedBrush}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
</Trigger>
2025-08-20 12:10:13 +08:00
<DataTrigger Binding="{Binding Href, Converter={x:Static converters:NullOrEmptyConverter.Instance}, RelativeSource={RelativeSource Mode=Self}}" Value="True">
2025-08-12 23:08:54 +08:00
<Setter Property="IsEnabled" Value="False" />
</DataTrigger>
<DataTrigger Value="True">
<DataTrigger.Binding>
<MultiBinding Converter="{x:Static converters:IsLastItemConverter.Instance}">
<Binding RelativeSource="{RelativeSource AncestorType=controls:Breadcrumb}" />
<Binding RelativeSource="{RelativeSource Mode=Self}" />
</MultiBinding>
</DataTrigger.Binding>
<Setter Property="Visibility" TargetName="separator" Value="Collapsed" />
<Setter Property="Visibility" TargetName="separatorIcon" Value="Collapsed" />
</DataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type controls:Breadcrumb}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="ItemContainerStyle" Value="{StaticResource BreadcrumbItem}" />
<Setter Property="Margin" Value="0" />
<Setter Property="Padding" Value="3" />
<Setter Property="Separator" Value="/" />
<Setter Property="SeparatorBrush" Value="{DynamicResource TextSecondaryBrush}" />
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:Breadcrumb}">
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
x:Name="Bd">
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" TargetName="Bd" Value="0.5" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>