mirror of
https://github.com/Blinue/Magpie.git
synced 2026-06-24 02:04:10 +00:00
136 lines
6.3 KiB
XML
136 lines
6.3 KiB
XML
<!-- 移植自 https://github.com/microsoft/PowerToys/blob/35bfb0f83e5fc08cc04398e7aa98d77774412d3f/src/settings-ui/Settings.UI/Controls/KeyVisual/KeyVisual.xaml -->
|
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:local="using:Magpie.App">
|
|
|
|
<x:Double x:Key="DefaultIconSize">16</x:Double>
|
|
<x:Double x:Key="SmallIconSize">12</x:Double>
|
|
<Style x:Key="DefaultTextKeyVisualStyle"
|
|
TargetType="local:KeyVisual">
|
|
<Setter Property="MinWidth" Value="56" />
|
|
<Setter Property="MinHeight" Value="48" />
|
|
<Setter Property="Background" Value="{ThemeResource AccentButtonBackground}" />
|
|
<Setter Property="Foreground" Value="{ThemeResource AccentButtonForeground}" />
|
|
<Setter Property="BorderBrush" Value="{ThemeResource AccentButtonBorderBrush}" />
|
|
<Setter Property="BorderThickness" Value="{ThemeResource ButtonBorderThemeThickness}" />
|
|
<Setter Property="Padding" Value="16,8,16,8" />
|
|
<Setter Property="FontWeight" Value="SemiBold" />
|
|
<Setter Property="HorizontalAlignment" Value="Center" />
|
|
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
|
<Setter Property="FontSize" Value="18" />
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="local:KeyVisual">
|
|
<Grid>
|
|
<Grid>
|
|
<Rectangle x:Name="ContentHolder"
|
|
Height="{TemplateBinding Height}"
|
|
MinWidth="{TemplateBinding MinWidth}"
|
|
Fill="{TemplateBinding Background}"
|
|
RadiusX="4"
|
|
RadiusY="4"
|
|
Stroke="{TemplateBinding BorderBrush}"
|
|
StrokeThickness="{TemplateBinding BorderThickness}" />
|
|
<ContentPresenter x:Name="KeyPresenter"
|
|
Margin="{TemplateBinding Padding}"
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
VerticalAlignment="Center"
|
|
Content="{TemplateBinding Content}"
|
|
FontSize="{TemplateBinding FontSize}"
|
|
FontWeight="{TemplateBinding FontWeight}"
|
|
Foreground="{TemplateBinding Foreground}" />
|
|
</Grid>
|
|
<VisualStateManager.VisualStateGroups>
|
|
<VisualStateGroup x:Name="CommonStates">
|
|
<VisualState x:Name="Normal" />
|
|
<VisualState x:Name="Disabled">
|
|
<VisualState.Setters>
|
|
<Setter Target="ContentHolder.Fill" Value="{ThemeResource AccentButtonBackgroundDisabled}" />
|
|
<Setter Target="KeyPresenter.Foreground" Value="{ThemeResource AccentButtonForegroundDisabled}" />
|
|
<Setter Target="ContentHolder.Stroke" Value="{ThemeResource AccentButtonBorderBrushDisabled}" />
|
|
<!--<Setter Target="ContentHolder.StrokeThickness" Value="{TemplateBinding BorderThickness}" />-->
|
|
</VisualState.Setters>
|
|
</VisualState>
|
|
</VisualStateGroup>
|
|
<VisualStateGroup x:Name="StateStates">
|
|
<VisualState x:Name="Default" />
|
|
<VisualState x:Name="Error">
|
|
<VisualState.Setters>
|
|
<Setter Target="ContentHolder.Fill" Value="{ThemeResource InfoBarErrorSeverityBackgroundBrush}" />
|
|
<Setter Target="KeyPresenter.Foreground" Value="{ThemeResource InfoBarErrorSeverityIconBackground}" />
|
|
<Setter Target="ContentHolder.Stroke" Value="{ThemeResource InfoBarErrorSeverityIconBackground}" />
|
|
<Setter Target="ContentHolder.StrokeThickness" Value="2" />
|
|
</VisualState.Setters>
|
|
</VisualState>
|
|
</VisualStateGroup>
|
|
</VisualStateManager.VisualStateGroups>
|
|
</Grid>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<Style x:Key="SmallTextKeyVisualStyle"
|
|
BasedOn="{StaticResource DefaultTextKeyVisualStyle}"
|
|
TargetType="local:KeyVisual">
|
|
<Setter Property="MinWidth" Value="40" />
|
|
<Setter Property="Height" Value="36" />
|
|
<Setter Property="FontWeight" Value="SemiBold" />
|
|
<Setter Property="Padding" Value="12,0,12,2" />
|
|
<Setter Property="FontSize" Value="14" />
|
|
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
|
</Style>
|
|
|
|
<Style x:Key="SmallOutlineTextKeyVisualStyle"
|
|
BasedOn="{StaticResource DefaultTextKeyVisualStyle}"
|
|
TargetType="local:KeyVisual">
|
|
<Setter Property="MinWidth" Value="40" />
|
|
<Setter Property="Background" Value="{ThemeResource ButtonBackground}" />
|
|
<Setter Property="Foreground" Value="{ThemeResource ButtonForeground}" />
|
|
<Setter Property="BorderBrush" Value="{ThemeResource ButtonBorderBrush}" />
|
|
<Setter Property="Height" Value="36" />
|
|
<Setter Property="FontWeight" Value="SemiBold" />
|
|
<Setter Property="Padding" Value="8,0,8,2" />
|
|
<Setter Property="FontSize" Value="13" />
|
|
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
|
</Style>
|
|
|
|
|
|
<Style x:Key="DefaultIconKeyVisualStyle"
|
|
BasedOn="{StaticResource DefaultTextKeyVisualStyle}"
|
|
TargetType="local:KeyVisual">
|
|
<Setter Property="MinWidth" Value="56" />
|
|
<Setter Property="MinHeight" Value="48" />
|
|
<Setter Property="FontFamily" Value="{ThemeResource SymbolThemeFontFamily}" />
|
|
<Setter Property="Padding" Value="16,8,16,8" />
|
|
<Setter Property="FontSize" Value="14" />
|
|
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
|
</Style>
|
|
|
|
<Style x:Key="SmallIconKeyVisualStyle"
|
|
BasedOn="{StaticResource DefaultTextKeyVisualStyle}"
|
|
TargetType="local:KeyVisual">
|
|
<Setter Property="MinWidth" Value="40" />
|
|
<Setter Property="Height" Value="36" />
|
|
<Setter Property="FontFamily" Value="{ThemeResource SymbolThemeFontFamily}" />
|
|
<Setter Property="FontWeight" Value="Normal" />
|
|
<Setter Property="Padding" Value="0" />
|
|
<Setter Property="FontSize" Value="10" />
|
|
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
|
</Style>
|
|
|
|
<Style x:Key="SmallOutlineIconKeyVisualStyle"
|
|
BasedOn="{StaticResource DefaultTextKeyVisualStyle}"
|
|
TargetType="local:KeyVisual">
|
|
<Setter Property="MinWidth" Value="40" />
|
|
<Setter Property="Background" Value="{ThemeResource ButtonBackground}" />
|
|
<Setter Property="Foreground" Value="{ThemeResource ButtonForeground}" />
|
|
<Setter Property="BorderBrush" Value="{ThemeResource ButtonBorderBrush}" />
|
|
<Setter Property="FontFamily" Value="{ThemeResource SymbolThemeFontFamily}" />
|
|
<Setter Property="Height" Value="36" />
|
|
<Setter Property="FontWeight" Value="SemiBold" />
|
|
<Setter Property="Padding" Value="0" />
|
|
<Setter Property="FontSize" Value="9" />
|
|
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
|
</Style>
|
|
</ResourceDictionary>
|