Files
ShrlAlgoToolkit/WPFluent.Gallery/Controls/GalleryNavigationPresenter.xaml

62 lines
3.5 KiB
Plaintext
Raw Normal View History

2025-04-24 20:56:44 +08:00
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:controls="clr-namespace:WPFluent.Gallery.Controls"
xmlns:models="clr-namespace:WPFluent.Gallery.Models"
xmlns:ui="https://github.com/ShrlAlgo/WPFluent"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="{x:Type controls:GalleryNavigationPresenter}">
<Setter Property="Focusable" Value="False" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type controls:GalleryNavigationPresenter}">
<ItemsControl ItemsSource="{TemplateBinding ItemsSource}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type models:NavigationCard}">
<ui:CardAction
Command="{Binding TemplateButtonCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=controls:GalleryNavigationPresenter}, Mode=OneWay}"
CommandParameter="{Binding PageType, Mode=OneTime}"
Height="90"
HorizontalAlignment="Left"
IsChevronVisible="True"
Margin="4"
VerticalAlignment="Stretch"
Width="320">
<ui:CardAction.Icon>
<ui:SymbolIcon
FontSize="30"
Symbol="{Binding Icon, Mode=OneTime}"
TextElement.Foreground="{DynamicResource TextFillColorPrimaryBrush}" />
</ui:CardAction.Icon>
<StackPanel>
<ui:TextBlock
FontSize="16"
FontTypography="BodyStrong"
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
Text="{Binding Name, Mode=OneTime}"
TextWrapping="Wrap" />
<ui:TextBlock
Appearance="Secondary"
FontSize="12"
Foreground="{DynamicResource TextFillColorSecondaryBrush}"
Text="{Binding Description, Mode=OneTime}"
TextWrapping="Wrap" />
</StackPanel>
</ui:CardAction>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>