Merge pull request #552 from irihitech/typesetting

Replace kinds of Discrete Resources
This commit is contained in:
Dong Bin
2025-03-10 12:05:15 +08:00
committed by GitHub
21 changed files with 56 additions and 45 deletions

View File

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

View File

@@ -42,7 +42,7 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
x:DataType="x:String"
FontSize="12"
FontSize="{DynamicResource CalendarItemWeekDayNameFontSize}"
FontWeight="{DynamicResource CalendarItemWeekDayNameFontWeight}"
Foreground="{DynamicResource CalendarItemWeekDayNameForeground}"
Text="{Binding}" />

View File

@@ -12,7 +12,8 @@
<Setter Property="Padding" Value="{DynamicResource MenuFlyoutPadding}" />
<Setter Property="Focusable" Value="True" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="FontSize" Value="{DynamicResource MenuFlyoutFontSize}" />
<Setter Property="FontWeight" Value="{DynamicResource MenuFlyoutFontWeight}" />
<Setter Property="WindowManagerAddShadowHint" Value="False" />
<Setter Property="Template">
<ControlTemplate TargetType="ContextMenu">

View File

@@ -2,15 +2,19 @@
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:CompileBindings="True">
<Design.PreviewWith>
<Border Padding="20">
<DatePickerPresenter />
</Border>
</Design.PreviewWith>
<ControlTheme x:Key="{x:Type DatePickerPresenter}" TargetType="DatePickerPresenter">
<Setter Property="Width" Value="296" />
<Setter Property="MinWidth" Value="296" />
<Setter Property="MaxHeight" Value="300" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="Background" Value="{DynamicResource DateTimePickerPopupBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource DateTimePickerPopupBorderBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="6" />
<Setter Property="CornerRadius" Value="{DynamicResource DateTimePickerPopupCornerRadius}" />
<Setter Property="Template">
<ControlTemplate TargetType="DatePickerPresenter">
<Border
@@ -92,8 +96,7 @@
VerticalAlignment="Stretch"
Theme="{StaticResource DateTimePickerButton}">
<PathIcon
Width="12"
Height="12"
Theme="{StaticResource InnerPathIcon}"
Data="{DynamicResource DateTimePickerAcceptGlyph}" />
</Button>
<Rectangle
@@ -107,8 +110,7 @@
VerticalAlignment="Stretch"
Theme="{StaticResource DateTimePickerButton}">
<PathIcon
Width="12"
Height="12"
Theme="{StaticResource InnerPathIcon}"
Data="{DynamicResource DateTimePickerDismissGlyph}" />
</Button>
<Rectangle

View File

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

View File

@@ -3,6 +3,7 @@
<Setter Property="Background" Value="{DynamicResource WindowDefaultBackground}" />
<Setter Property="Foreground" Value="{DynamicResource WindowDefaultForeground}" />
<Setter Property="FontSize" Value="{DynamicResource DefaultFontSize}" />
<Setter Property="FontWeight" Value="{DynamicResource DefaultFontWeight}" />
<Setter Property="FontFamily" Value="{DynamicResource DefaultFontFamily}" />
<Setter Property="Template">
<ControlTemplate>

View File

@@ -59,7 +59,6 @@
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
CornerRadius="{TemplateBinding CornerRadius}"
FontWeight="Normal"
Foreground="{TemplateBinding Foreground}" />
</ControlTemplate>
</Setter>

View File

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

View File

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

View File

@@ -192,7 +192,7 @@
<ControlTemplate TargetType="Thumb">
<Border
Background="{TemplateBinding Foreground}"
CornerRadius="24"
CornerRadius="{DynamicResource ScrollBarThumbCornerRadius}"
UseLayoutRounding="False" />
</ControlTemplate>
</Setter>

View File

@@ -29,7 +29,6 @@
<Setter Property="BorderThickness" Value="{DynamicResource TextBoxBorderThickness}" />
<Setter Property="BackgroundSizing" Value="OuterBorderEdge" />
<Setter Property="CornerRadius" Value="{DynamicResource TextBoxDefaultCornerRadius}" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Cursor" Value="Ibeam" />
<Setter Property="CaretBrush" Value="{DynamicResource TextBoxTextCaretBrush}" />
<Setter Property="Padding" Value="{DynamicResource TextBoxContentPadding}" />
@@ -237,7 +236,6 @@
<Setter Property="BorderThickness" Value="{DynamicResource TextBoxBorderThickness}" />
<Setter Property="BackgroundSizing" Value="OuterBorderEdge" />
<Setter Property="CornerRadius" Value="{DynamicResource TextBoxDefaultCornerRadius}" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Cursor" Value="Ibeam" />
<Setter Property="CaretBrush" Value="{DynamicResource TextBoxTextCaretBrush}" />
<Setter Property="Padding" Value="{DynamicResource TextBoxContentPadding}" />
@@ -440,7 +438,6 @@
<Setter Property="Foreground" Value="{DynamicResource TextBoxForeground}" />
<Setter Property="SelectionBrush" Value="{DynamicResource TextBoxSelectionBackground}" />
<Setter Property="SelectionForegroundBrush" Value="{DynamicResource TextBoxSelectionForeground}" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Cursor" Value="Ibeam" />
<Setter Property="CaretBrush" Value="{DynamicResource TextBoxTextCaretBrush}" />
<Setter Property="Padding" Value="{DynamicResource TextBoxContentPadding}" />

View File

@@ -5,6 +5,7 @@
<ControlTheme x:Key="{x:Type ThemeVariantScope}" TargetType="ThemeVariantScope">
<Setter Property="TextElement.Foreground" Value="{DynamicResource DefaultForeground}" />
<Setter Property="TextElement.FontSize" Value="{DynamicResource DefaultFontSize}" />
<Setter Property="TextElement.FontWeight" Value="{DynamicResource DefaultFontWeight}" />
<Setter Property="TextElement.FontFamily" Value="{DynamicResource DefaultFontFamily}" />
</ControlTheme>
</ResourceDictionary>

View File

@@ -2,6 +2,11 @@
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:CompileBindings="True">
<Design.PreviewWith>
<Border Padding="20">
<TimePickerPresenter />
</Border>
</Design.PreviewWith>
<ControlTheme x:Key="{x:Type TimePickerPresenter}" TargetType="TimePickerPresenter">
<Setter Property="Width" Value="242" />
<Setter Property="MinWidth" Value="242" />
@@ -10,7 +15,7 @@
<Setter Property="Background" Value="{DynamicResource DateTimePickerPopupBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource DateTimePickerPopupBorderBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="6" />
<Setter Property="CornerRadius" Value="{DynamicResource DateTimePickerPopupCornerRadius}" />
<Setter Property="Template">
<ControlTemplate TargetType="TimePickerPresenter">
<Border
@@ -113,8 +118,7 @@
VerticalAlignment="Stretch"
Theme="{StaticResource DateTimePickerButton}">
<PathIcon
Width="12"
Height="12"
Theme="{StaticResource InnerPathIcon}"
Data="{DynamicResource DateTimePickerAcceptGlyph}" />
</Button>
<Rectangle
@@ -126,11 +130,9 @@
Grid.Column="2"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
FontSize="16"
Theme="{StaticResource DateTimePickerButton}">
<PathIcon
Width="12"
Height="12"
Theme="{StaticResource InnerPathIcon}"
Data="{DynamicResource DateTimePickerDismissGlyph}" />
</Button>
<Rectangle
@@ -158,7 +160,7 @@
<Setter Property="Background" Value="{DynamicResource DateTimePickerButtonBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource DateTimePickerButtonBorderBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource DateTimePickerButtonBorderThickness}" />
<Setter Property="CornerRadius" Value="3" />
<Setter Property="CornerRadius" Value="{DynamicResource DateTimePickerButtonCornerRadius}" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="MinHeight" Value="{DynamicResource DateTimePickerButtonDefaultHeight}" />

View File

@@ -96,7 +96,7 @@
<ControlTheme x:Key="{x:Type TreeViewItem}" TargetType="TreeViewItem">
<Setter Property="Background" Value="{DynamicResource TreeViewItemDefaultBackground}" />
<Setter Property="Foreground" Value="{DynamicResource TreeViewItemDefaultForeground}" />
<Setter Property="CornerRadius" Value="3" />
<Setter Property="CornerRadius" Value="{DynamicResource TreeViewItemDefaultCornerRadius}" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Template">
<ControlTemplate TargetType="TreeViewItem">

View File

@@ -7,6 +7,7 @@
<Setter Property="TransparencyBackgroundFallback" Value="{DynamicResource WindowDefaultBackground}" />
<Setter Property="Foreground" Value="{DynamicResource WindowDefaultForeground}" />
<Setter Property="FontSize" Value="{DynamicResource DefaultFontSize}" />
<Setter Property="FontWeight" Value="{DynamicResource DefaultFontWeight}" />
<Setter Property="FontFamily" Value="{DynamicResource DefaultFontFamily}" />
<Setter Property="Template">
<ControlTemplate TargetType="Window">

View File

@@ -10,4 +10,5 @@
<StaticResource x:Key="CalendarItemCalendarDayButtonCornerRadius" ResourceKey="SemiBorderRadiusSmall" />
<x:Double x:Key="CalendarMinWidth">240</x:Double>
<x:Double x:Key="CalendarMinHeight">250</x:Double>
<StaticResource x:Key="CalendarItemWeekDayNameFontSize" ResourceKey="SemiFontSizeSmall" />
</ResourceDictionary>

View File

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

View File

@@ -1,6 +1,6 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StaticResource x:Key="MenuScrollViewerUpButtonGlyph" ResourceKey="SemiIconCaretUp" />
<StaticResource x:Key="MenuScrollViewerDownButtonGlyph" ResourceKey="SemiIconCaretDown" />
<StaticResource x:Key="MenuScrollViewerUpButtonGlyph" ResourceKey="SemiIconTriangleUp" />
<StaticResource x:Key="MenuScrollViewerDownButtonGlyph" ResourceKey="SemiIconTriangleDown" />
<StaticResource x:Key="MenuItemExpandIconGlyph" ResourceKey="SemiIconChevronRight" />
<StaticResource x:Key="MenuCheckGlyph" ResourceKey="SemiIconTick" />
<!-- MenuFlyout -->
@@ -11,6 +11,8 @@
<x:Double x:Key="MenuFlyoutMinWidth">100</x:Double>
<x:Double x:Key="MenuFlyoutMaxHeight">400</x:Double>
<x:Double x:Key="MenuFlyoutMaxWidth">600</x:Double>
<StaticResource x:Key="MenuFlyoutFontSize" ResourceKey="SemiFontSizeRegular" />
<StaticResource x:Key="MenuFlyoutFontWeight" ResourceKey="SemiFontWeightRegular" />
<!-- MenuItem -->
<Thickness x:Key="TopLevelMenuItemPadding">16 0</Thickness>
<StaticResource x:Key="TopLevelMenuItemMinHeight" ResourceKey="SemiHeightControlDefault" />

View File

@@ -1,6 +1,7 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StaticResource x:Key="ScrollBarThickness" ResourceKey="SemiSpacingTight" />
<StaticResource x:Key="ScrollBarThumbThickness" ResourceKey="SemiSpacingTight" />
<StaticResource x:Key="ScrollBarThumbCornerRadius" ResourceKey="SemiBorderRadiusMedium" />
<StaticResource x:Key="ScrollBarUpGlyph" ResourceKey="SemiIconSmallTriangleTop" />
<StaticResource x:Key="ScrollBarDownGlyph" ResourceKey="SemiIconSmallTriangleDown" />
<StaticResource x:Key="ScrollBarLeftGlyph" ResourceKey="SemiIconSmallTriangleLeft" />

View File

@@ -1,4 +1,5 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StaticResource x:Key="TreeViewItemDefaultCornerRadius" ResourceKey="SemiBorderRadiusSmall" />
<x:Double x:Key="TreeViewItemIndent">20</x:Double>
<x:Double x:Key="TreeViewItemIconSize">8</x:Double>
<StaticResource x:Key="ExpanderIconData" ResourceKey="SemiIconTreeTriangleRight" />

View File

@@ -1,4 +1,5 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StaticResource x:Key="DefaultFontSize" ResourceKey="SemiFontSizeRegular" />
<StaticResource x:Key="DefaultFontWeight" ResourceKey="SemiFontWeightRegular" />
<StaticResource x:Key="DefaultFontFamily" ResourceKey="SemiFontFamilyRegular" />
</ResourceDictionary>