feat: replace discrete Icon Size.

This commit is contained in:
Zhang Dian
2025-03-06 23:35:31 +08:00
parent 42233d272c
commit 30f39d1383
8 changed files with 38 additions and 32 deletions

View File

@@ -272,8 +272,8 @@
</ControlTheme> </ControlTheme>
<ControlTheme x:Key="InnerIconButton" TargetType="Button"> <ControlTheme x:Key="InnerIconButton" TargetType="Button">
<Setter Property="Width" Value="16" /> <Setter Property="Width" Value="{DynamicResource SemiWidthIconMedium}" />
<Setter Property="Height" Value="16" /> <Setter Property="Height" Value="{DynamicResource SemiWidthIconMedium}" />
<Setter Property="Foreground" Value="{DynamicResource ButtonInputInnerForeground}" /> <Setter Property="Foreground" Value="{DynamicResource ButtonInputInnerForeground}" />
<Setter Property="Background" Value="Transparent" /> <Setter Property="Background" Value="Transparent" />
<Setter Property="Cursor" Value="Hand" /> <Setter Property="Cursor" Value="Hand" />

View File

@@ -2,6 +2,11 @@
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:CompileBindings="True"> x:CompileBindings="True">
<Design.PreviewWith>
<Border Padding="20">
<DatePickerPresenter />
</Border>
</Design.PreviewWith>
<ControlTheme x:Key="{x:Type DatePickerPresenter}" TargetType="DatePickerPresenter"> <ControlTheme x:Key="{x:Type DatePickerPresenter}" TargetType="DatePickerPresenter">
<Setter Property="Width" Value="296" /> <Setter Property="Width" Value="296" />
<Setter Property="MinWidth" Value="296" /> <Setter Property="MinWidth" Value="296" />
@@ -91,8 +96,7 @@
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
Theme="{StaticResource DateTimePickerButton}"> Theme="{StaticResource DateTimePickerButton}">
<PathIcon <PathIcon
Width="12" Theme="{StaticResource InnerPathIcon}"
Height="12"
Data="{DynamicResource DateTimePickerAcceptGlyph}" /> Data="{DynamicResource DateTimePickerAcceptGlyph}" />
</Button> </Button>
<Rectangle <Rectangle
@@ -106,8 +110,7 @@
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
Theme="{StaticResource DateTimePickerButton}"> Theme="{StaticResource DateTimePickerButton}">
<PathIcon <PathIcon
Width="12" Theme="{StaticResource InnerPathIcon}"
Height="12"
Data="{DynamicResource DateTimePickerDismissGlyph}" /> Data="{DynamicResource DateTimePickerDismissGlyph}" />
</Button> </Button>
<Rectangle <Rectangle

View File

@@ -115,8 +115,8 @@
<Setter Property="Content"> <Setter Property="Content">
<Template> <Template>
<PathIcon <PathIcon
Width="8" Theme="{StaticResource InnerPathIcon}"
Height="8" Classes="ExtraSmall"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center" VerticalAlignment="Center"
Data="{DynamicResource DateTimePickerButtonUpGlyph}" /> Data="{DynamicResource DateTimePickerButtonUpGlyph}" />
@@ -136,8 +136,8 @@
<Setter Property="Content"> <Setter Property="Content">
<Template> <Template>
<PathIcon <PathIcon
Width="8" Theme="{StaticResource InnerPathIcon}"
Height="8" Classes="ExtraSmall"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center" VerticalAlignment="Center"
Data="{DynamicResource DateTimePickerButtonDownGlyph}" /> Data="{DynamicResource DateTimePickerButtonDownGlyph}" />

View File

@@ -37,8 +37,8 @@
</MultiBinding> </MultiBinding>
</RepeatButton.IsVisible> </RepeatButton.IsVisible>
<PathIcon <PathIcon
Width="8" Theme="{StaticResource InnerPathIcon}"
Height="8" Classes="ExtraSmall"
Data="{DynamicResource MenuScrollViewerUpButtonGlyph}" Data="{DynamicResource MenuScrollViewerUpButtonGlyph}"
Foreground="{DynamicResource MenuFlyoutScrollViewerIconForeground}" /> Foreground="{DynamicResource MenuFlyoutScrollViewerIconForeground}" />
</RepeatButton> </RepeatButton>
@@ -63,8 +63,8 @@
</MultiBinding> </MultiBinding>
</RepeatButton.IsVisible> </RepeatButton.IsVisible>
<PathIcon <PathIcon
Width="8" Theme="{StaticResource InnerPathIcon}"
Height="8" Classes="ExtraSmall"
Data="{DynamicResource MenuScrollViewerDownButtonGlyph}" Data="{DynamicResource MenuScrollViewerDownButtonGlyph}"
Foreground="{DynamicResource MenuFlyoutScrollViewerIconForeground}" /> Foreground="{DynamicResource MenuFlyoutScrollViewerIconForeground}" />
</RepeatButton> </RepeatButton>

View File

@@ -25,8 +25,8 @@
</ControlTheme> </ControlTheme>
<ControlTheme x:Key="InnerPathIcon" TargetType="PathIcon"> <ControlTheme x:Key="InnerPathIcon" TargetType="PathIcon">
<Setter Property="Height" Value="16" /> <Setter Property="Width" Value="{StaticResource SemiWidthIconMedium}" />
<Setter Property="Width" Value="16" /> <Setter Property="Height" Value="{StaticResource SemiWidthIconMedium}" />
<Setter Property="Background" Value="Transparent" /> <Setter Property="Background" Value="Transparent" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate TargetType="PathIcon"> <ControlTemplate TargetType="PathIcon">
@@ -48,20 +48,20 @@
<Setter Property="Fill" Value="{TemplateBinding BorderBrush}" /> <Setter Property="Fill" Value="{TemplateBinding BorderBrush}" />
</Style> </Style>
<Style Selector="^.ExtraSmall"> <Style Selector="^.ExtraSmall">
<Setter Property="Height" Value="8" /> <Setter Property="Width" Value="{StaticResource SemiWidthIconExtraSmall}" />
<Setter Property="Width" Value="8" /> <Setter Property="Height" Value="{StaticResource SemiWidthIconExtraSmall}" />
</Style> </Style>
<Style Selector="^.Small"> <Style Selector="^.Small">
<Setter Property="Height" Value="12" /> <Setter Property="Width" Value="{StaticResource SemiWidthIconSmall}" />
<Setter Property="Width" Value="12" /> <Setter Property="Height" Value="{StaticResource SemiWidthIconSmall}" />
</Style> </Style>
<Style Selector="^.Large"> <Style Selector="^.Large">
<Setter Property="Height" Value="20" /> <Setter Property="Width" Value="{StaticResource SemiWidthIconLarge}" />
<Setter Property="Width" Value="20" /> <Setter Property="Height" Value="{StaticResource SemiWidthIconLarge}" />
</Style> </Style>
<Style Selector="^.ExtraLarge"> <Style Selector="^.ExtraLarge">
<Setter Property="Height" Value="24" /> <Setter Property="Width" Value="{StaticResource SemiWidthIconExtraLarge}" />
<Setter Property="Width" Value="24" /> <Setter Property="Height" Value="{StaticResource SemiWidthIconExtraLarge}" />
</Style> </Style>
</ControlTheme> </ControlTheme>
</ResourceDictionary> </ResourceDictionary>

View File

@@ -2,6 +2,11 @@
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:CompileBindings="True"> x:CompileBindings="True">
<Design.PreviewWith>
<Border Padding="20">
<TimePickerPresenter />
</Border>
</Design.PreviewWith>
<ControlTheme x:Key="{x:Type TimePickerPresenter}" TargetType="TimePickerPresenter"> <ControlTheme x:Key="{x:Type TimePickerPresenter}" TargetType="TimePickerPresenter">
<Setter Property="Width" Value="242" /> <Setter Property="Width" Value="242" />
<Setter Property="MinWidth" Value="242" /> <Setter Property="MinWidth" Value="242" />
@@ -112,8 +117,7 @@
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
Theme="{StaticResource DateTimePickerButton}"> Theme="{StaticResource DateTimePickerButton}">
<PathIcon <PathIcon
Width="12" Theme="{StaticResource InnerPathIcon}"
Height="12"
Data="{DynamicResource DateTimePickerAcceptGlyph}" /> Data="{DynamicResource DateTimePickerAcceptGlyph}" />
</Button> </Button>
<Rectangle <Rectangle
@@ -127,8 +131,7 @@
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
Theme="{StaticResource DateTimePickerButton}"> Theme="{StaticResource DateTimePickerButton}">
<PathIcon <PathIcon
Width="12" Theme="{StaticResource InnerPathIcon}"
Height="12"
Data="{DynamicResource DateTimePickerDismissGlyph}" /> Data="{DynamicResource DateTimePickerDismissGlyph}" />
</Button> </Button>
<Rectangle <Rectangle

View File

@@ -1,6 +1,6 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StaticResource x:Key="DateTimePickerButtonUpGlyph" ResourceKey="SemiIconCaretUp" /> <StaticResource x:Key="DateTimePickerButtonUpGlyph" ResourceKey="SemiIconTriangleUp" />
<StaticResource x:Key="DateTimePickerButtonDownGlyph" ResourceKey="SemiIconCaretDown" /> <StaticResource x:Key="DateTimePickerButtonDownGlyph" ResourceKey="SemiIconTriangleDown" />
<StaticResource x:Key="DateTimePickerAcceptGlyph" ResourceKey="SemiIconTick" /> <StaticResource x:Key="DateTimePickerAcceptGlyph" ResourceKey="SemiIconTick" />
<StaticResource x:Key="DateTimePickerDismissGlyph" ResourceKey="SemiIconClose" /> <StaticResource x:Key="DateTimePickerDismissGlyph" ResourceKey="SemiIconClose" />
<StaticResource x:Key="DateTimePickerPopupCornerRadius" ResourceKey="SemiBorderRadiusMedium" /> <StaticResource x:Key="DateTimePickerPopupCornerRadius" ResourceKey="SemiBorderRadiusMedium" />

View File

@@ -1,6 +1,6 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StaticResource x:Key="MenuScrollViewerUpButtonGlyph" ResourceKey="SemiIconCaretUp" /> <StaticResource x:Key="MenuScrollViewerUpButtonGlyph" ResourceKey="SemiIconTriangleUp" />
<StaticResource x:Key="MenuScrollViewerDownButtonGlyph" ResourceKey="SemiIconCaretDown" /> <StaticResource x:Key="MenuScrollViewerDownButtonGlyph" ResourceKey="SemiIconTriangleDown" />
<StaticResource x:Key="MenuItemExpandIconGlyph" ResourceKey="SemiIconChevronRight" /> <StaticResource x:Key="MenuItemExpandIconGlyph" ResourceKey="SemiIconChevronRight" />
<StaticResource x:Key="MenuCheckGlyph" ResourceKey="SemiIconTick" /> <StaticResource x:Key="MenuCheckGlyph" ResourceKey="SemiIconTick" />
<!-- MenuFlyout --> <!-- MenuFlyout -->