优化更新代码,添加界面功能并整合
This commit is contained in:
133
WPFluent/Controls/CardAction/CardAction.xaml
Normal file
133
WPFluent/Controls/CardAction/CardAction.xaml
Normal file
@@ -0,0 +1,133 @@
|
||||
<!--
|
||||
This Source Code Form is subject to the terms of the MIT License.
|
||||
If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
|
||||
Copyright (C) Leszek Pomianowski and WPF UI Contributors.
|
||||
All Rights Reserved.
|
||||
|
||||
Based on Microsoft XAML for Win UI
|
||||
Copyright (c) Microsoft Corporation. All Rights Reserved.
|
||||
-->
|
||||
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:WPFluent.Controls"
|
||||
xmlns:system="clr-namespace:System;assembly=System.Runtime">
|
||||
|
||||
<Thickness x:Key="CardActionPadding">14,16,14,16</Thickness>
|
||||
<Thickness x:Key="CardActionBorderThemeThickness">1</Thickness>
|
||||
<Thickness x:Key="CardActionIconMargin">0,0,14,0</Thickness>
|
||||
<Thickness x:Key="CardActionChevronMargin">4,0,0,0</Thickness>
|
||||
<system:Double x:Key="CardActionIconSize">24.0</system:Double>
|
||||
<system:Double x:Key="CardActionChevronSize">16.0</system:Double>
|
||||
|
||||
<Style x:Key="DefaultUiCardActionStyle" TargetType="{x:Type controls:CardAction}">
|
||||
<!-- Universal WPF UI focus -->
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource DefaultControlFocusVisualStyle}" />
|
||||
<!-- Universal WPF UI focus -->
|
||||
<Setter Property="Background" Value="{DynamicResource CardBackground}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource CardForeground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource CardBorderBrush}" />
|
||||
<Setter Property="BorderThickness" Value="{StaticResource CardActionBorderThemeThickness}" />
|
||||
<Setter Property="Padding" Value="{StaticResource CardActionPadding}" />
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
|
||||
<Setter Property="FontWeight" Value="Normal" />
|
||||
<Setter Property="Border.CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
|
||||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||
<Setter Property="OverridesDefaultStyle" Value="True" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type controls:CardAction}">
|
||||
<Border
|
||||
x:Name="ContentBorder"
|
||||
Width="{TemplateBinding Width}"
|
||||
Height="{TemplateBinding Height}"
|
||||
MinWidth="{TemplateBinding MinWidth}"
|
||||
MinHeight="{TemplateBinding MinHeight}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalAlignment}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding Border.CornerRadius}">
|
||||
<Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<ContentControl
|
||||
x:Name="ControlIcon"
|
||||
Grid.Column="0"
|
||||
Margin="{StaticResource CardActionIconMargin}"
|
||||
VerticalAlignment="Center"
|
||||
Content="{TemplateBinding Icon}"
|
||||
Focusable="False"
|
||||
FontSize="{StaticResource CardActionIconSize}"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
KeyboardNavigation.IsTabStop="False" />
|
||||
|
||||
<ContentPresenter
|
||||
x:Name="ContentPresenter"
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
Content="{TemplateBinding Content}"
|
||||
TextElement.Foreground="{TemplateBinding Foreground}" />
|
||||
|
||||
<controls:SymbolIcon
|
||||
x:Name="ChevronIcon"
|
||||
Grid.Column="2"
|
||||
Margin="{StaticResource CardActionChevronMargin}"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="{StaticResource CardActionChevronSize}"
|
||||
Symbol="ChevronRight24" />
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource CardBackgroundPointerOver}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ControlElevationBorderBrush}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource CardForegroundPointerOver}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsChevronVisible" Value="False">
|
||||
<Setter TargetName="ChevronIcon" Property="Visibility" Value="Collapsed" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Background" Value="{DynamicResource CardBackgroundDisabled}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource CardBorderBrushDisabled}" />
|
||||
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource CardForegroundDisabled}" />
|
||||
<Setter TargetName="ControlIcon" Property="Foreground" Value="{DynamicResource CardForegroundDisabled}" />
|
||||
<Setter TargetName="ChevronIcon" Property="Foreground" Value="{DynamicResource CardForegroundDisabled}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource CardBackgroundPressed}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource CardBorderBrushPressed}" />
|
||||
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource CardForegroundPressed}" />
|
||||
<Setter TargetName="ControlIcon" Property="Foreground" Value="{DynamicResource CardForegroundPressed}" />
|
||||
<Setter TargetName="ChevronIcon" Property="Foreground" Value="{DynamicResource CardForegroundPressed}" />
|
||||
</Trigger>
|
||||
<Trigger Property="Content" Value="{x:Null}">
|
||||
<Setter TargetName="ControlIcon" Property="Margin" Value="0" />
|
||||
</Trigger>
|
||||
<Trigger Property="Content" Value="">
|
||||
<Setter TargetName="ControlIcon" Property="Margin" Value="0" />
|
||||
</Trigger>
|
||||
<Trigger Property="Icon" Value="{x:Null}">
|
||||
<Setter TargetName="ControlIcon" Property="Margin" Value="0" />
|
||||
<Setter TargetName="ControlIcon" Property="Visibility" Value="Collapsed" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style BasedOn="{StaticResource DefaultUiCardActionStyle}" TargetType="{x:Type controls:CardAction}" />
|
||||
|
||||
</ResourceDictionary>
|
||||
Reference in New Issue
Block a user