From b92f3e8c285cb13e898cc48ae220297f3d523ac3 Mon Sep 17 00:00:00 2001 From: polarboy Date: Tue, 20 Aug 2024 17:21:24 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=20Token=20=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E7=94=9F=E6=88=90=E7=B1=BB=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 重构 Token 资源生成类名,加上 Token 后缀 --- .../AddOnDecoratedBox/AddOnDecoratedBox.cs | 14 +-- .../AddOnDecoratedBoxTheme.cs | 32 +++--- .../AddOnDecoratedInnerBox.cs | 2 +- .../AddOnDecoratedInnerBoxTheme.cs | 98 +++++++++---------- src/AtomUI.Controls/Alert/Alert.cs | 6 +- src/AtomUI.Controls/Alert/AlertTheme.cs | 54 +++++----- .../ArrowDecoratedBoxTheme.cs | 12 +-- src/AtomUI.Controls/Badge/CountBadge.cs | 2 +- .../Badge/CountBadgeAdorner.cs | 20 ++-- src/AtomUI.Controls/Badge/DotBadge.cs | 2 +- src/AtomUI.Controls/Badge/DotBadgeAdorner.cs | 22 ++--- .../Badge/RibbonBadgeAdorner.cs | 16 +-- .../ButtonSpinner/ButtonSpinnerInnerBox.cs | 6 +- .../ButtonSpinner/ButtonSpinnerTheme.cs | 28 +++--- .../Buttons/BaseButtonTheme.cs | 70 ++++++------- src/AtomUI.Controls/Buttons/Button.cs | 2 +- .../Buttons/DefaultButtonTheme.cs | 82 ++++++++-------- .../Buttons/LinkButtonTheme.cs | 38 +++---- .../Buttons/PrimaryButtonTheme.cs | 64 ++++++------ .../Buttons/TextButtonTheme.cs | 30 +++--- src/AtomUI.Controls/CheckBox/CheckBox.cs | 4 +- src/AtomUI.Controls/CheckBox/CheckBoxTheme.cs | 40 ++++---- src/AtomUI.Controls/Collapse/Collapse.cs | 2 +- src/AtomUI.Controls/Collapse/CollapseItem.cs | 4 +- .../Collapse/CollapseItemTheme.cs | 56 +++++------ src/AtomUI.Controls/Collapse/CollapseTheme.cs | 4 +- .../EmptyIndicator/EmptyIndicator.cs | 8 +- .../EmptyIndicator/EmptyIndicatorTheme.cs | 12 +-- src/AtomUI.Controls/Expander/Expander.cs | 6 +- src/AtomUI.Controls/Expander/ExpanderTheme.cs | 62 ++++++------ src/AtomUI.Controls/Flyouts/Flyout.cs | 4 +- src/AtomUI.Controls/Flyouts/FlyoutHost.cs | 2 +- .../Flyouts/MenuFlyoutPresenterTheme.cs | 16 +-- .../TokenResourceConst.g.cs | 54 +++++----- src/AtomUI.Controls/Input/SearchEdit.cs | 2 +- .../Input/TextBoxInnerBoxTheme.cs | 2 +- src/AtomUI.Controls/Input/TextBoxTheme.cs | 18 ++-- .../Loading/LoadingIndicatorTheme.cs | 16 +-- .../Loading/Localization/en_US.cs | 2 +- .../Loading/Localization/zh_CN.cs | 2 +- .../MarqueeLabel/MarqueeLabel.cs | 4 +- src/AtomUI.Controls/Menu/ContextMenuTheme.cs | 16 +-- src/AtomUI.Controls/Menu/MenuItem.cs | 6 +- src/AtomUI.Controls/Menu/MenuItemTheme.cs | 50 +++++----- .../Menu/MenuScrollViewerTheme.cs | 16 +-- src/AtomUI.Controls/Menu/MenuSeparator.cs | 2 +- .../Menu/MenuSeparatorTheme.cs | 4 +- src/AtomUI.Controls/Menu/MenuTheme.cs | 16 +-- .../Menu/TopLevelMenuItemTheme.cs | 62 ++++++------ .../OptionButtonBox/OptionButtonGroupTheme.cs | 18 ++-- .../OptionButtonBox/OptionButtonTheme.cs | 88 ++++++++--------- src/AtomUI.Controls/Popup/Popup.cs | 4 +- .../AbstractCircleProgressTheme.cs | 12 +-- .../ProgressBar/AbstractLineProgressTheme.cs | 36 +++---- .../ProgressBar/AbstractProgressBar.cs | 6 +- .../ProgressBar/AbstractProgressBarTheme.cs | 18 ++-- .../ProgressBar/ProgressBar.cs | 4 +- .../ProgressBar/ProgressBarTheme.cs | 4 +- .../ProgressBar/StepsProgressBar.cs | 4 +- .../RadioButton/RadioButton.cs | 4 +- .../RadioButton/RadioButtonTheme.cs | 26 ++--- src/AtomUI.Controls/Segmented/Segmented.cs | 2 +- .../Segmented/SegmentedItem.cs | 6 +- .../Segmented/SegmentedItemBoxTheme.cs | 42 ++++---- .../Segmented/SegmentedItemTheme.cs | 14 +-- .../Segmented/SegmentedTheme.cs | 20 ++-- src/AtomUI.Controls/Separator/Separator.cs | 2 +- .../Separator/SeparatorTheme.cs | 12 +-- src/AtomUI.Controls/Slider/SliderTheme.cs | 28 +++--- src/AtomUI.Controls/Slider/SliderThumb.cs | 2 +- .../Slider/SliderThumbTheme.cs | 22 ++--- src/AtomUI.Controls/Slider/SliderTrack.cs | 10 +- src/AtomUI.Controls/Switch/SwitchKnob.cs | 2 +- .../Switch/ToggleSwitchTheme.cs | 72 +++++++------- .../TabControl/BaseOverflowMenuItemTheme.cs | 26 ++--- .../TabControl/BaseTabControl.cs | 4 +- .../TabControl/BaseTabControlTheme.cs | 2 +- .../TabControl/BaseTabItemTheme.cs | 30 +++--- .../TabControl/BaseTabScrollViewer.cs | 4 +- .../TabControl/BaseTabScrollViewerTheme.cs | 30 +++--- .../TabControl/CardTabControl.cs | 10 +- .../TabControl/CardTabControlTheme.cs | 28 +++--- .../TabControl/CardTabItemTheme.cs | 24 ++--- src/AtomUI.Controls/TabControl/TabControl.cs | 4 +- .../TabControl/TabControlTheme.cs | 10 +- src/AtomUI.Controls/TabControl/TabItem.cs | 18 ++-- .../TabControl/TabItemTheme.cs | 14 +-- .../TabControl/TabStrip/BaseTabStrip.cs | 2 +- .../TabStrip/BaseTabStripItemTheme.cs | 30 +++--- .../TabControl/TabStrip/BaseTabStripTheme.cs | 2 +- .../TabControl/TabStrip/CardTabStrip.cs | 10 +- .../TabStrip/CardTabStripItemTheme.cs | 24 ++--- .../TabControl/TabStrip/CardTabStripTheme.cs | 28 +++--- .../TabControl/TabStrip/TabStrip.cs | 4 +- .../TabControl/TabStrip/TabStripItem.cs | 18 ++-- .../TabControl/TabStrip/TabStripItemTheme.cs | 14 +-- .../TabControl/TabStrip/TabStripTheme.cs | 10 +- src/AtomUI.Controls/Tag/Tag.cs | 20 ++-- src/AtomUI.Controls/Tag/TagTheme.cs | 22 ++--- src/AtomUI.Controls/Tooltip/ToolTip.cs | 2 +- src/AtomUI.Controls/Tooltip/ToolTipTheme.cs | 22 ++--- .../TreeView/DragPreviewAdorner.cs | 2 +- .../TreeView/NodeSwitcherButton.cs | 4 +- .../TreeView/NodeSwitcherButtonTheme.cs | 6 +- src/AtomUI.Controls/TreeView/TreeView.cs | 4 +- src/AtomUI.Controls/TreeView/TreeViewItem.cs | 16 +-- .../TreeView/TreeViewItemTheme.cs | 38 +++---- src/AtomUI.Generator/AtomUI.Generator.csproj | 3 - src/AtomUI.Generator/Language/LanguageInfo.cs | 15 +++ .../Language/LanguageProviderWalker.cs | 52 ++++++++++ .../Language/ResourceKeyClassSourceWriter.cs | 6 ++ src/AtomUI.Generator/LanguageGenerator.cs | 26 +++++ .../TokenInfo/ControlTokenPropertyWalker.cs | 8 +- .../TokenInfo/ResourceKeyClassSourceWriter.cs | 4 +- .../TokenInfo/TokenPropertyWalker.cs | 6 +- .../TokenResourceKeyGenerator.cs | 4 +- .../TokenResourceConst.g.cs | 2 +- src/AtomUI.Theme/Utils/AnimationUtils.cs | 2 +- 118 files changed, 1128 insertions(+), 1032 deletions(-) create mode 100644 src/AtomUI.Generator/Language/LanguageInfo.cs create mode 100644 src/AtomUI.Generator/Language/LanguageProviderWalker.cs create mode 100644 src/AtomUI.Generator/Language/ResourceKeyClassSourceWriter.cs create mode 100644 src/AtomUI.Generator/LanguageGenerator.cs diff --git a/src/AtomUI.Controls/AddOnDecoratedBox/AddOnDecoratedBox.cs b/src/AtomUI.Controls/AddOnDecoratedBox/AddOnDecoratedBox.cs index 68ce499..b21aa70 100644 --- a/src/AtomUI.Controls/AddOnDecoratedBox/AddOnDecoratedBox.cs +++ b/src/AtomUI.Controls/AddOnDecoratedBox/AddOnDecoratedBox.cs @@ -202,21 +202,21 @@ public class AddOnDecoratedBox : ContentControl private void SetupIconTypeAddOnSize(PathIcon icon) { if (SizeType == SizeType.Large) { - TokenResourceBinder.CreateGlobalTokenBinding(icon, PathIcon.WidthProperty, GlobalResourceKey.IconSizeLG); - TokenResourceBinder.CreateGlobalTokenBinding(icon, PathIcon.HeightProperty, GlobalResourceKey.IconSizeLG); + TokenResourceBinder.CreateGlobalTokenBinding(icon, PathIcon.WidthProperty, GlobalTokenResourceKey.IconSizeLG); + TokenResourceBinder.CreateGlobalTokenBinding(icon, PathIcon.HeightProperty, GlobalTokenResourceKey.IconSizeLG); } else if (SizeType == SizeType.Middle) { - TokenResourceBinder.CreateGlobalTokenBinding(icon, PathIcon.WidthProperty, GlobalResourceKey.IconSize); - TokenResourceBinder.CreateGlobalTokenBinding(icon, PathIcon.HeightProperty, GlobalResourceKey.IconSize); + TokenResourceBinder.CreateGlobalTokenBinding(icon, PathIcon.WidthProperty, GlobalTokenResourceKey.IconSize); + TokenResourceBinder.CreateGlobalTokenBinding(icon, PathIcon.HeightProperty, GlobalTokenResourceKey.IconSize); } else { - TokenResourceBinder.CreateGlobalTokenBinding(icon, PathIcon.WidthProperty, GlobalResourceKey.IconSizeSM); - TokenResourceBinder.CreateGlobalTokenBinding(icon, PathIcon.HeightProperty, GlobalResourceKey.IconSizeSM); + TokenResourceBinder.CreateGlobalTokenBinding(icon, PathIcon.WidthProperty, GlobalTokenResourceKey.IconSizeSM); + TokenResourceBinder.CreateGlobalTokenBinding(icon, PathIcon.HeightProperty, GlobalTokenResourceKey.IconSizeSM); } } protected override void OnApplyTemplate(TemplateAppliedEventArgs e) { base.OnApplyTemplate(e); - TokenResourceBinder.CreateGlobalResourceBinding(this, BorderThicknessProperty, GlobalResourceKey.BorderThickness, + TokenResourceBinder.CreateGlobalResourceBinding(this, BorderThicknessProperty, GlobalTokenResourceKey.BorderThickness, BindingPriority.Template, new RenderScaleAwareThicknessConfigure(this)); _leftAddOnPresenter = e.NameScope.Find(AddOnDecoratedBoxTheme.LeftAddOnPart); diff --git a/src/AtomUI.Controls/AddOnDecoratedBox/AddOnDecoratedBoxTheme.cs b/src/AtomUI.Controls/AddOnDecoratedBox/AddOnDecoratedBoxTheme.cs index bbdcdd9..8c68d1f 100644 --- a/src/AtomUI.Controls/AddOnDecoratedBox/AddOnDecoratedBoxTheme.cs +++ b/src/AtomUI.Controls/AddOnDecoratedBox/AddOnDecoratedBoxTheme.cs @@ -81,9 +81,9 @@ internal class AddOnDecoratedBoxTheme : BaseControlTheme leftAddOnContentPresenter.RegisterInNameScope(scope); TokenResourceBinder.CreateTokenBinding(leftAddOnContentPresenter, ContentPresenter.BackgroundProperty, - AddOnDecoratedBoxResourceKey.AddonBg); + AddOnDecoratedBoxTokenResourceKey.AddonBg); TokenResourceBinder.CreateTokenBinding(leftAddOnContentPresenter, ContentPresenter.BorderBrushProperty, - GlobalResourceKey.ColorBorder); + GlobalTokenResourceKey.ColorBorder); Grid.SetColumn(leftAddOnContentPresenter, 0); layout.Children.Add(leftAddOnContentPresenter); @@ -123,9 +123,9 @@ internal class AddOnDecoratedBoxTheme : BaseControlTheme BindingMode.Default, ObjectConverters.IsNotNull); TokenResourceBinder.CreateTokenBinding(rightAddOnContentPresenter, ContentPresenter.BackgroundProperty, - AddOnDecoratedBoxResourceKey.AddonBg); + AddOnDecoratedBoxTokenResourceKey.AddonBg); TokenResourceBinder.CreateTokenBinding(rightAddOnContentPresenter, ContentPresenter.BorderBrushProperty, - GlobalResourceKey.ColorBorder); + GlobalTokenResourceKey.ColorBorder); rightAddOnContentPresenter.RegisterInNameScope(scope); layout.Children.Add(rightAddOnContentPresenter); @@ -141,19 +141,19 @@ internal class AddOnDecoratedBoxTheme : BaseControlTheme private void BuildCommonStyle() { var commonStyle = new Style(selector => selector.Nesting()); - commonStyle.Add(AddOnDecoratedBox.ForegroundProperty, GlobalResourceKey.ColorText); + commonStyle.Add(AddOnDecoratedBox.ForegroundProperty, GlobalTokenResourceKey.ColorText); var largeStyle = new Style(selector => selector.Nesting().PropertyEquals(AddOnDecoratedBox.SizeTypeProperty, SizeType.Large)); { var addOnStyle = new Style(selector => Selectors.Or(selector.Nesting().Template().Name(LeftAddOnPart), selector.Nesting().Template().Name(RightAddOnPart))); - addOnStyle.Add(ContentPresenter.PaddingProperty, AddOnDecoratedBoxResourceKey.PaddingLG); + addOnStyle.Add(ContentPresenter.PaddingProperty, AddOnDecoratedBoxTokenResourceKey.PaddingLG); largeStyle.Add(addOnStyle); } - largeStyle.Add(AddOnDecoratedBox.FontSizeProperty, AddOnDecoratedBoxResourceKey.FontSizeLG); - largeStyle.Add(AddOnDecoratedBox.CornerRadiusProperty, GlobalResourceKey.BorderRadiusLG); + largeStyle.Add(AddOnDecoratedBox.FontSizeProperty, AddOnDecoratedBoxTokenResourceKey.FontSizeLG); + largeStyle.Add(AddOnDecoratedBox.CornerRadiusProperty, GlobalTokenResourceKey.BorderRadiusLG); commonStyle.Add(largeStyle); var middleStyle = @@ -161,12 +161,12 @@ internal class AddOnDecoratedBoxTheme : BaseControlTheme { var addOnStyle = new Style(selector => Selectors.Or(selector.Nesting().Template().Name(LeftAddOnPart), selector.Nesting().Template().Name(RightAddOnPart))); - addOnStyle.Add(ContentPresenter.PaddingProperty, AddOnDecoratedBoxResourceKey.Padding); + addOnStyle.Add(ContentPresenter.PaddingProperty, AddOnDecoratedBoxTokenResourceKey.Padding); middleStyle.Add(addOnStyle); } - middleStyle.Add(AddOnDecoratedBox.FontSizeProperty, AddOnDecoratedBoxResourceKey.FontSize); - middleStyle.Add(AddOnDecoratedBox.CornerRadiusProperty, GlobalResourceKey.BorderRadius); + middleStyle.Add(AddOnDecoratedBox.FontSizeProperty, AddOnDecoratedBoxTokenResourceKey.FontSize); + middleStyle.Add(AddOnDecoratedBox.CornerRadiusProperty, GlobalTokenResourceKey.BorderRadius); commonStyle.Add(middleStyle); var smallStyle = @@ -174,12 +174,12 @@ internal class AddOnDecoratedBoxTheme : BaseControlTheme { var addOnStyle = new Style(selector => Selectors.Or(selector.Nesting().Template().Name(LeftAddOnPart), selector.Nesting().Template().Name(RightAddOnPart))); - addOnStyle.Add(ContentPresenter.PaddingProperty, AddOnDecoratedBoxResourceKey.PaddingSM); + addOnStyle.Add(ContentPresenter.PaddingProperty, AddOnDecoratedBoxTokenResourceKey.PaddingSM); smallStyle.Add(addOnStyle); } - smallStyle.Add(AddOnDecoratedBox.FontSizeProperty, AddOnDecoratedBoxResourceKey.FontSizeSM); - smallStyle.Add(AddOnDecoratedBox.CornerRadiusProperty, GlobalResourceKey.BorderRadiusSM); + smallStyle.Add(AddOnDecoratedBox.FontSizeProperty, AddOnDecoratedBoxTokenResourceKey.FontSizeSM); + smallStyle.Add(AddOnDecoratedBox.CornerRadiusProperty, GlobalTokenResourceKey.BorderRadiusSM); commonStyle.Add(smallStyle); Add(commonStyle); @@ -188,10 +188,10 @@ internal class AddOnDecoratedBoxTheme : BaseControlTheme private void BuildDisabledStyle() { var disabledStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Disabled)); - disabledStyle.Add(AddOnDecoratedBox.ForegroundProperty, GlobalResourceKey.ColorTextDisabled); + disabledStyle.Add(AddOnDecoratedBox.ForegroundProperty, GlobalTokenResourceKey.ColorTextDisabled); // TODO 暂时这么简单处理吧 var addOnStyle = new Style(selector => selector.Nesting().Template().OfType()); - addOnStyle.Add(ContentPresenter.ForegroundProperty, GlobalResourceKey.ColorTextDisabled); + addOnStyle.Add(ContentPresenter.ForegroundProperty, GlobalTokenResourceKey.ColorTextDisabled); disabledStyle.Add(addOnStyle); Add(disabledStyle); } diff --git a/src/AtomUI.Controls/AddOnDecoratedBox/AddOnDecoratedInnerBox.cs b/src/AtomUI.Controls/AddOnDecoratedBox/AddOnDecoratedInnerBox.cs index d4ac78f..e46a704 100644 --- a/src/AtomUI.Controls/AddOnDecoratedBox/AddOnDecoratedInnerBox.cs +++ b/src/AtomUI.Controls/AddOnDecoratedBox/AddOnDecoratedInnerBox.cs @@ -152,7 +152,7 @@ public abstract class AddOnDecoratedInnerBox : ContentControl protected override void OnApplyTemplate(TemplateAppliedEventArgs e) { base.OnApplyTemplate(e); - TokenResourceBinder.CreateGlobalResourceBinding(this, MarginXSTokenProperty, GlobalResourceKey.MarginXS); + TokenResourceBinder.CreateGlobalResourceBinding(this, MarginXSTokenProperty, GlobalTokenResourceKey.MarginXS); _leftAddOnLayout = e.NameScope.Find(AddOnDecoratedInnerBoxTheme.LeftAddOnLayoutPart); _rightAddOnLayout = e.NameScope.Find(AddOnDecoratedInnerBoxTheme.RightAddOnLayoutPart); _clearButton = e.NameScope.Find(AddOnDecoratedInnerBoxTheme.ClearButtonPart); diff --git a/src/AtomUI.Controls/AddOnDecoratedBox/AddOnDecoratedInnerBoxTheme.cs b/src/AtomUI.Controls/AddOnDecoratedBox/AddOnDecoratedInnerBoxTheme.cs index 5e46d64..585c055 100644 --- a/src/AtomUI.Controls/AddOnDecoratedBox/AddOnDecoratedInnerBoxTheme.cs +++ b/src/AtomUI.Controls/AddOnDecoratedBox/AddOnDecoratedInnerBoxTheme.cs @@ -96,7 +96,7 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme Name = LeftAddOnLayoutPart, Orientation = Orientation.Horizontal, }; - TokenResourceBinder.CreateGlobalTokenBinding(addLayout, StackPanel.SpacingProperty, GlobalResourceKey.PaddingXXS); + TokenResourceBinder.CreateGlobalTokenBinding(addLayout, StackPanel.SpacingProperty, GlobalTokenResourceKey.PaddingXXS); addLayout.RegisterInNameScope(scope); var leftAddOnContentPresenter = new ContentPresenter() @@ -142,7 +142,7 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme Name = RightAddOnLayoutPart, Orientation = Orientation.Horizontal }; - TokenResourceBinder.CreateGlobalTokenBinding(addLayout, StackPanel.SpacingProperty, GlobalResourceKey.PaddingXXS); + TokenResourceBinder.CreateGlobalTokenBinding(addLayout, StackPanel.SpacingProperty, GlobalTokenResourceKey.PaddingXXS); addLayout.RegisterInNameScope(scope); var rightAddOnContentPresenter = new ContentPresenter() { @@ -181,14 +181,14 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme Icon = closeIcon }; - TokenResourceBinder.CreateGlobalTokenBinding(clearButton, IconButton.IconHeightProperty, GlobalResourceKey.IconSize); - TokenResourceBinder.CreateGlobalTokenBinding(clearButton, IconButton.IconWidthProperty, GlobalResourceKey.IconSize); + TokenResourceBinder.CreateGlobalTokenBinding(clearButton, IconButton.IconHeightProperty, GlobalTokenResourceKey.IconSize); + TokenResourceBinder.CreateGlobalTokenBinding(clearButton, IconButton.IconWidthProperty, GlobalTokenResourceKey.IconSize); TokenResourceBinder.CreateGlobalTokenBinding(closeIcon, PathIcon.NormalFilledBrushProperty, - GlobalResourceKey.ColorTextQuaternary); + GlobalTokenResourceKey.ColorTextQuaternary); TokenResourceBinder.CreateGlobalTokenBinding(closeIcon, PathIcon.ActiveFilledBrushProperty, - GlobalResourceKey.ColorTextTertiary); + GlobalTokenResourceKey.ColorTextTertiary); TokenResourceBinder.CreateGlobalTokenBinding(closeIcon, PathIcon.SelectedFilledBrushProperty, - GlobalResourceKey.ColorText); + GlobalTokenResourceKey.ColorText); clearButton.RegisterInNameScope(scope); CreateTemplateParentBinding(clearButton, IconButton.IsVisibleProperty, @@ -215,52 +215,52 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme var largeStyle = new Style(selector => selector.Nesting().PropertyEquals(AddOnDecoratedInnerBox.SizeTypeProperty, SizeType.Large)); - largeStyle.Add(AddOnDecoratedInnerBox.InnerBoxPaddingProperty, AddOnDecoratedBoxResourceKey.PaddingLG); + largeStyle.Add(AddOnDecoratedInnerBox.InnerBoxPaddingProperty, AddOnDecoratedBoxTokenResourceKey.PaddingLG); { var innerBoxContentStyle = new Style(selector => selector.Nesting().Template().Name(ContentPresenterPart)); - innerBoxContentStyle.Add(TextBlock.LineHeightProperty, GlobalResourceKey.FontHeightLG); - innerBoxContentStyle.Add(Border.MinHeightProperty, GlobalResourceKey.FontHeightLG); + innerBoxContentStyle.Add(TextBlock.LineHeightProperty, GlobalTokenResourceKey.FontHeightLG); + innerBoxContentStyle.Add(Border.MinHeightProperty, GlobalTokenResourceKey.FontHeightLG); largeStyle.Add(innerBoxContentStyle); } { var iconStyle = new Style(selector => selector.Nesting().Template().Descendant().OfType()); - iconStyle.Add(PathIcon.WidthProperty, GlobalResourceKey.IconSizeLG); - iconStyle.Add(PathIcon.HeightProperty, GlobalResourceKey.IconSizeLG); + iconStyle.Add(PathIcon.WidthProperty, GlobalTokenResourceKey.IconSizeLG); + iconStyle.Add(PathIcon.HeightProperty, GlobalTokenResourceKey.IconSizeLG); largeStyle.Add(iconStyle); } commonStyle.Add(largeStyle); var middleStyle = new Style(selector => selector.Nesting().PropertyEquals(AddOnDecoratedInnerBox.SizeTypeProperty, SizeType.Middle)); - middleStyle.Add(AddOnDecoratedInnerBox.InnerBoxPaddingProperty, AddOnDecoratedBoxResourceKey.Padding); + middleStyle.Add(AddOnDecoratedInnerBox.InnerBoxPaddingProperty, AddOnDecoratedBoxTokenResourceKey.Padding); { var innerBoxContentStyle = new Style(selector => selector.Nesting().Template().Name(ContentPresenterPart)); - innerBoxContentStyle.Add(TextBlock.LineHeightProperty, GlobalResourceKey.FontHeight); - innerBoxContentStyle.Add(Border.MinHeightProperty, GlobalResourceKey.FontHeight); + innerBoxContentStyle.Add(TextBlock.LineHeightProperty, GlobalTokenResourceKey.FontHeight); + innerBoxContentStyle.Add(Border.MinHeightProperty, GlobalTokenResourceKey.FontHeight); middleStyle.Add(innerBoxContentStyle); } { var iconStyle = new Style(selector => selector.Nesting().Template().Descendant().OfType()); - iconStyle.Add(PathIcon.WidthProperty, GlobalResourceKey.IconSize); - iconStyle.Add(PathIcon.HeightProperty, GlobalResourceKey.IconSize); + iconStyle.Add(PathIcon.WidthProperty, GlobalTokenResourceKey.IconSize); + iconStyle.Add(PathIcon.HeightProperty, GlobalTokenResourceKey.IconSize); middleStyle.Add(iconStyle); } commonStyle.Add(middleStyle); var smallStyle = new Style(selector => selector.Nesting().PropertyEquals(AddOnDecoratedInnerBox.SizeTypeProperty, SizeType.Small)); - smallStyle.Add(AddOnDecoratedInnerBox.InnerBoxPaddingProperty, AddOnDecoratedBoxResourceKey.PaddingSM); + smallStyle.Add(AddOnDecoratedInnerBox.InnerBoxPaddingProperty, AddOnDecoratedBoxTokenResourceKey.PaddingSM); { var innerBoxContentStyle = new Style(selector => selector.Nesting().Template().Name(ContentPresenterPart)); - innerBoxContentStyle.Add(TextBlock.LineHeightProperty, GlobalResourceKey.FontHeightSM); - innerBoxContentStyle.Add(Border.MinHeightProperty, GlobalResourceKey.FontHeightSM); + innerBoxContentStyle.Add(TextBlock.LineHeightProperty, GlobalTokenResourceKey.FontHeightSM); + innerBoxContentStyle.Add(Border.MinHeightProperty, GlobalTokenResourceKey.FontHeightSM); smallStyle.Add(innerBoxContentStyle); } { var iconStyle = new Style(selector => selector.Nesting().Template().Descendant().OfType()); - iconStyle.Add(PathIcon.WidthProperty, GlobalResourceKey.IconSizeSM); - iconStyle.Add(PathIcon.HeightProperty, GlobalResourceKey.IconSizeSM); + iconStyle.Add(PathIcon.WidthProperty, GlobalTokenResourceKey.IconSizeSM); + iconStyle.Add(PathIcon.HeightProperty, GlobalTokenResourceKey.IconSizeSM); smallStyle.Add(iconStyle); } commonStyle.Add(smallStyle); @@ -278,7 +278,7 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme { var innerBoxDecoratorStyle = new Style(selector => selector.Nesting().Template().Name(InnerBoxDecoratorPart)); - innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, GlobalResourceKey.ColorBorder); + innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, GlobalTokenResourceKey.ColorBorder); outlineStyle.Add(innerBoxDecoratorStyle); } @@ -286,7 +286,7 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme { var innerBoxDecoratorStyle = new Style(selector => selector.Nesting().Template().Name(InnerBoxDecoratorPart)); - innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, AddOnDecoratedBoxResourceKey.HoverBorderColor); + innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, AddOnDecoratedBoxTokenResourceKey.HoverBorderColor); hoverStyle.Add(innerBoxDecoratorStyle); } @@ -296,7 +296,7 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme { var innerBoxDecoratorStyle = new Style(selector => selector.Nesting().Template().Name(InnerBoxDecoratorPart)); - innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, AddOnDecoratedBoxResourceKey.ActiveBorderColor); + innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, AddOnDecoratedBoxTokenResourceKey.ActiveBorderColor); focusStyle.Add(innerBoxDecoratorStyle); } outlineStyle.Add(focusStyle); @@ -307,7 +307,7 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme { var innerBoxDecoratorStyle = new Style(selector => selector.Nesting().Template().Name(InnerBoxDecoratorPart)); - innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, GlobalResourceKey.ColorError); + innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, GlobalTokenResourceKey.ColorError); errorStyle.Add(innerBoxDecoratorStyle); } @@ -315,7 +315,7 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme { var innerBoxDecoratorStyle = new Style(selector => selector.Nesting().Template().Name(InnerBoxDecoratorPart)); - innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, GlobalResourceKey.ColorErrorBorderHover); + innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, GlobalTokenResourceKey.ColorErrorBorderHover); hoverStyle.Add(innerBoxDecoratorStyle); } errorStyle.Add(hoverStyle); @@ -324,7 +324,7 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme { var innerBoxDecoratorStyle = new Style(selector => selector.Nesting().Template().Name(InnerBoxDecoratorPart)); - innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, GlobalResourceKey.ColorError); + innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, GlobalTokenResourceKey.ColorError); focusStyle.Add(innerBoxDecoratorStyle); } errorStyle.Add(focusStyle); @@ -337,7 +337,7 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme { var innerBoxDecoratorStyle = new Style(selector => selector.Nesting().Template().Name(InnerBoxDecoratorPart)); - innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, GlobalResourceKey.ColorWarning); + innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, GlobalTokenResourceKey.ColorWarning); warningStyle.Add(innerBoxDecoratorStyle); } @@ -345,7 +345,7 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme { var innerBoxDecoratorStyle = new Style(selector => selector.Nesting().Template().Name(InnerBoxDecoratorPart)); - innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, GlobalResourceKey.ColorWarningBorderHover); + innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, GlobalTokenResourceKey.ColorWarningBorderHover); hoverStyle.Add(innerBoxDecoratorStyle); } warningStyle.Add(hoverStyle); @@ -354,7 +354,7 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme { var innerBoxDecoratorStyle = new Style(selector => selector.Nesting().Template().Name(InnerBoxDecoratorPart)); - innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, GlobalResourceKey.ColorWarning); + innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, GlobalTokenResourceKey.ColorWarning); focusStyle.Add(innerBoxDecoratorStyle); } warningStyle.Add(focusStyle); @@ -374,15 +374,15 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme var innerBoxDecoratorStyle = new Style(selector => selector.Nesting().Template().Name(InnerBoxDecoratorPart)); - innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, GlobalResourceKey.ColorTransparent); - innerBoxDecoratorStyle.Add(Border.BackgroundProperty, GlobalResourceKey.ColorFillTertiary); + innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, GlobalTokenResourceKey.ColorTransparent); + innerBoxDecoratorStyle.Add(Border.BackgroundProperty, GlobalTokenResourceKey.ColorFillTertiary); filledStyle.Add(innerBoxDecoratorStyle); } var hoverStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver)); { var innerBoxDecoratorStyle = new Style(selector => selector.Nesting().Template().Name(InnerBoxDecoratorPart)); - innerBoxDecoratorStyle.Add(Border.BackgroundProperty, GlobalResourceKey.ColorFillSecondary); + innerBoxDecoratorStyle.Add(Border.BackgroundProperty, GlobalTokenResourceKey.ColorFillSecondary); hoverStyle.Add(innerBoxDecoratorStyle); } filledStyle.Add(hoverStyle); @@ -390,8 +390,8 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme var focusStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.FocusWithIn)); { var innerBoxDecoratorStyle = new Style(selector => selector.Nesting().Template().Name(InnerBoxDecoratorPart)); - innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, AddOnDecoratedBoxResourceKey.ActiveBorderColor); - innerBoxDecoratorStyle.Add(Border.BackgroundProperty, GlobalResourceKey.ColorTransparent); + innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, AddOnDecoratedBoxTokenResourceKey.ActiveBorderColor); + innerBoxDecoratorStyle.Add(Border.BackgroundProperty, GlobalTokenResourceKey.ColorTransparent); focusStyle.Add(innerBoxDecoratorStyle); } filledStyle.Add(focusStyle); @@ -404,8 +404,8 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme var innerBoxDecoratorStyle = new Style(selector => selector.Nesting().Template().Name(InnerBoxDecoratorPart)); - innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, GlobalResourceKey.ColorTransparent); - innerBoxDecoratorStyle.Add(Border.BackgroundProperty, GlobalResourceKey.ColorErrorBg); + innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, GlobalTokenResourceKey.ColorTransparent); + innerBoxDecoratorStyle.Add(Border.BackgroundProperty, GlobalTokenResourceKey.ColorErrorBg); errorStyle.Add(innerBoxDecoratorStyle); } @@ -413,7 +413,7 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme { var innerBoxDecoratorStyle = new Style(selector => selector.Nesting().Template().Name(InnerBoxDecoratorPart)); - innerBoxDecoratorStyle.Add(Border.BackgroundProperty, GlobalResourceKey.ColorErrorBgHover); + innerBoxDecoratorStyle.Add(Border.BackgroundProperty, GlobalTokenResourceKey.ColorErrorBgHover); hoverStyle.Add(innerBoxDecoratorStyle); } errorStyle.Add(hoverStyle); @@ -422,8 +422,8 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme { var innerBoxDecoratorStyle = new Style(selector => selector.Nesting().Template().Name(InnerBoxDecoratorPart)); - innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, GlobalResourceKey.ColorError); - innerBoxDecoratorStyle.Add(Border.BackgroundProperty, AddOnDecoratedBoxResourceKey.ActiveBg); + innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, GlobalTokenResourceKey.ColorError); + innerBoxDecoratorStyle.Add(Border.BackgroundProperty, AddOnDecoratedBoxTokenResourceKey.ActiveBg); focusStyle.Add(innerBoxDecoratorStyle); } @@ -438,8 +438,8 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme var innerBoxDecoratorStyle = new Style(selector => selector.Nesting().Template().Name(InnerBoxDecoratorPart)); - innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, GlobalResourceKey.ColorTransparent); - innerBoxDecoratorStyle.Add(Border.BackgroundProperty, GlobalResourceKey.ColorWarningBg); + innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, GlobalTokenResourceKey.ColorTransparent); + innerBoxDecoratorStyle.Add(Border.BackgroundProperty, GlobalTokenResourceKey.ColorWarningBg); warningStyle.Add(innerBoxDecoratorStyle); } @@ -447,7 +447,7 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme { var innerBoxDecoratorStyle = new Style(selector => selector.Nesting().Template().Name(InnerBoxDecoratorPart)); - innerBoxDecoratorStyle.Add(Border.BackgroundProperty, GlobalResourceKey.ColorWarningBgHover); + innerBoxDecoratorStyle.Add(Border.BackgroundProperty, GlobalTokenResourceKey.ColorWarningBgHover); hoverStyle.Add(innerBoxDecoratorStyle); } warningStyle.Add(hoverStyle); @@ -456,8 +456,8 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme { var innerBoxDecoratorStyle = new Style(selector => selector.Nesting().Template().Name(InnerBoxDecoratorPart)); - innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, GlobalResourceKey.ColorWarning); - innerBoxDecoratorStyle.Add(Border.BackgroundProperty, AddOnDecoratedBoxResourceKey.ActiveBg); + innerBoxDecoratorStyle.Add(Border.BorderBrushProperty, GlobalTokenResourceKey.ColorWarning); + innerBoxDecoratorStyle.Add(Border.BackgroundProperty, AddOnDecoratedBoxTokenResourceKey.ActiveBg); focusStyle.Add(innerBoxDecoratorStyle); } warningStyle.Add(focusStyle); @@ -475,7 +475,7 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme { var iconStyle = new Style(selector => Selectors.Or(selector.Nesting().Template().Name(LeftAddOnPart), selector.Nesting().Template().Name(RightAddOnPart)).Nesting().Descendant().OfType()); - iconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalResourceKey.ColorError); + iconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorError); errorStyle.Add(iconStyle); } Add(errorStyle); @@ -486,7 +486,7 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme { var iconStyle = new Style(selector => Selectors.Or(selector.Nesting().Template().Name(LeftAddOnPart), selector.Nesting().Template().Name(RightAddOnPart)).Nesting().Descendant().OfType()); - iconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalResourceKey.ColorWarning); + iconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorWarning); warningStyle.Add(iconStyle); } Add(warningStyle); @@ -497,7 +497,7 @@ internal class AddOnDecoratedInnerBoxTheme : BaseControlTheme { var disabledStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Disabled)); var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(InnerBoxDecoratorPart)); - decoratorStyle.Add(Border.BackgroundProperty, GlobalResourceKey.ColorBgContainerDisabled); + decoratorStyle.Add(Border.BackgroundProperty, GlobalTokenResourceKey.ColorBgContainerDisabled); disabledStyle.Add(decoratorStyle); Add(disabledStyle); } diff --git a/src/AtomUI.Controls/Alert/Alert.cs b/src/AtomUI.Controls/Alert/Alert.cs index 2a73012..91b6761 100644 --- a/src/AtomUI.Controls/Alert/Alert.cs +++ b/src/AtomUI.Controls/Alert/Alert.cs @@ -130,7 +130,7 @@ public class Alert : TemplatedControl, IControlCustomStyle void IControlCustomStyle.HandleTemplateApplied(INameScope scope) { - TokenResourceBinder.CreateTokenBinding(this, BorderThicknessProperty, GlobalResourceKey.BorderThickness, + TokenResourceBinder.CreateTokenBinding(this, BorderThicknessProperty, GlobalTokenResourceKey.BorderThickness, BindingPriority.Template, new RenderScaleAwareThicknessConfigure(this)); SetupCloseButton(); @@ -152,8 +152,8 @@ public class Alert : TemplatedControl, IControlCustomStyle { Kind = "CloseOutlined", }; - TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.NormalFilledBrushProperty, GlobalResourceKey.ColorIcon); - TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.ActiveFilledBrushProperty, GlobalResourceKey.ColorIconHover); + TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorIcon); + TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.ActiveFilledBrushProperty, GlobalTokenResourceKey.ColorIconHover); } } diff --git a/src/AtomUI.Controls/Alert/AlertTheme.cs b/src/AtomUI.Controls/Alert/AlertTheme.cs index 777a3a1..c3e7177 100644 --- a/src/AtomUI.Controls/Alert/AlertTheme.cs +++ b/src/AtomUI.Controls/Alert/AlertTheme.cs @@ -40,38 +40,38 @@ internal class AlertTheme : BaseControlTheme private void BuildAlertTypeStyle() { - this.Add(Alert.CornerRadiusProperty, GlobalResourceKey.BorderRadiusLG); + this.Add(Alert.CornerRadiusProperty, GlobalTokenResourceKey.BorderRadiusLG); var successStyle = new Style(selector => selector.Nesting().PropertyEquals(Alert.TypeProperty, AlertType.Success)); - successStyle.Add(Alert.BackgroundProperty, GlobalResourceKey.ColorSuccessBg); - successStyle.Add(Alert.BorderBrushProperty, GlobalResourceKey.ColorSuccessBorder); + successStyle.Add(Alert.BackgroundProperty, GlobalTokenResourceKey.ColorSuccessBg); + successStyle.Add(Alert.BorderBrushProperty, GlobalTokenResourceKey.ColorSuccessBorder); Add(successStyle); var infoStyle = new Style(selector => selector.Nesting().PropertyEquals(Alert.TypeProperty, AlertType.Info)); - infoStyle.Add(Alert.BackgroundProperty, GlobalResourceKey.ColorInfoBg); - infoStyle.Add(Alert.BorderBrushProperty, GlobalResourceKey.ColorInfoBorder); + infoStyle.Add(Alert.BackgroundProperty, GlobalTokenResourceKey.ColorInfoBg); + infoStyle.Add(Alert.BorderBrushProperty, GlobalTokenResourceKey.ColorInfoBorder); Add(infoStyle); var warningStyle = new Style(selector => selector.Nesting().PropertyEquals(Alert.TypeProperty, AlertType.Warning)); - warningStyle.Add(Alert.BackgroundProperty, GlobalResourceKey.ColorWarningBg); - warningStyle.Add(Alert.BorderBrushProperty, GlobalResourceKey.ColorWarningBorder); + warningStyle.Add(Alert.BackgroundProperty, GlobalTokenResourceKey.ColorWarningBg); + warningStyle.Add(Alert.BorderBrushProperty, GlobalTokenResourceKey.ColorWarningBorder); Add(warningStyle); var errorStyle = new Style(selector => selector.Nesting().PropertyEquals(Alert.TypeProperty, AlertType.Error)); - errorStyle.Add(Alert.BackgroundProperty, GlobalResourceKey.ColorErrorBg); - errorStyle.Add(Alert.BorderBrushProperty, GlobalResourceKey.ColorErrorBorder); + errorStyle.Add(Alert.BackgroundProperty, GlobalTokenResourceKey.ColorErrorBg); + errorStyle.Add(Alert.BorderBrushProperty, GlobalTokenResourceKey.ColorErrorBorder); Add(errorStyle); // 根据是否显示 Description 设置 Padding { // 为空 var paddingStyle = new Style(selector => selector.Nesting().PropertyEquals(Alert.DescriptionProperty, null)); - paddingStyle.Add(TemplatedControl.PaddingProperty, AlertResourceKey.DefaultPadding); + paddingStyle.Add(TemplatedControl.PaddingProperty, AlertTokenResourceKey.DefaultPadding); Add(paddingStyle); } { // 不为空 var paddingStyle = new Style(selector => selector.Nesting().Not(x=> x.PropertyEquals(Alert.DescriptionProperty, null))); - paddingStyle.Add(TemplatedControl.PaddingProperty, AlertResourceKey.WithDescriptionPadding); + paddingStyle.Add(TemplatedControl.PaddingProperty, AlertTokenResourceKey.WithDescriptionPadding); Add(paddingStyle); } } @@ -85,7 +85,7 @@ internal class AlertTheme : BaseControlTheme // Description 不为空 var descriptionStyle = new Style(selector => selector.Nesting().Not(x=> x.PropertyEquals(Alert.DescriptionProperty, null))); var commonLabelStyle = new Style(selector => commonLabelSelector); - commonLabelStyle.Add(TemplatedControl.FontSizeProperty, GlobalResourceKey.FontSizeLG); + commonLabelStyle.Add(TemplatedControl.FontSizeProperty, GlobalTokenResourceKey.FontSizeLG); commonLabelStyle.Add(Layoutable.VerticalAlignmentProperty, VerticalAlignment.Top); descriptionStyle.Add(commonLabelStyle); Add(descriptionStyle); @@ -93,7 +93,7 @@ internal class AlertTheme : BaseControlTheme { var descriptionStyle = new Style(selector => selector.Nesting().PropertyEquals(Alert.DescriptionProperty, null)); var commonLabelStyle = new Style(selector => commonLabelSelector); - commonLabelStyle.Add(TemplatedControl.FontSizeProperty, GlobalResourceKey.FontSize); + commonLabelStyle.Add(TemplatedControl.FontSizeProperty, GlobalTokenResourceKey.FontSize); commonLabelStyle.Add(Layoutable.VerticalAlignmentProperty, VerticalAlignment.Stretch); descriptionStyle.Add(commonLabelStyle); Add(descriptionStyle); @@ -138,7 +138,7 @@ internal class AlertTheme : BaseControlTheme var successStyle = new Style(selector => selector.Nesting().PropertyEquals(Alert.TypeProperty, AlertType.Success)); var infoIconStyle = new Style(selector => infoIconSelector); infoIconStyle.Add(PathIcon.KindProperty, "CheckCircleFilled"); - infoIconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalResourceKey.ColorSuccess); + infoIconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorSuccess); successStyle.Add(infoIconStyle); Add(successStyle); } @@ -147,7 +147,7 @@ internal class AlertTheme : BaseControlTheme var infoStyle = new Style(selector => selector.Nesting().PropertyEquals(Alert.TypeProperty, AlertType.Info)); var infoIconStyle = new Style(selector => infoIconSelector); infoIconStyle.Add(PathIcon.KindProperty, "InfoCircleFilled"); - infoIconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalResourceKey.ColorPrimary); + infoIconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorPrimary); infoStyle.Add(infoIconStyle); Add(infoStyle); } @@ -156,7 +156,7 @@ internal class AlertTheme : BaseControlTheme var warningStyle = new Style(selector => selector.Nesting().PropertyEquals(Alert.TypeProperty, AlertType.Warning)); var infoIconStyle = new Style(selector => infoIconSelector); infoIconStyle.Add(PathIcon.KindProperty, "ExclamationCircleFilled"); - infoIconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalResourceKey.ColorWarning); + infoIconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorWarning); warningStyle.Add(infoIconStyle); Add(warningStyle); } @@ -165,7 +165,7 @@ internal class AlertTheme : BaseControlTheme var errorStyle = new Style(selector => selector.Nesting().PropertyEquals(Alert.TypeProperty, AlertType.Error)); var infoIconStyle = new Style(selector => infoIconSelector); infoIconStyle.Add(PathIcon.KindProperty, "CloseCircleFilled"); - infoIconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalResourceKey.ColorError); + infoIconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorError); errorStyle.Add(infoIconStyle); Add(errorStyle); } @@ -175,9 +175,9 @@ internal class AlertTheme : BaseControlTheme // 为空 var wrapperStyle = new Style(selector => selector.Nesting().PropertyEquals(Alert.DescriptionProperty, null)); var infoIconStyle = new Style(selector=> infoIconSelector); - infoIconStyle.Add(Layoutable.WidthProperty, AlertResourceKey.IconSize); - infoIconStyle.Add(Layoutable.HeightProperty, AlertResourceKey.IconSize); - infoIconStyle.Add(Layoutable.MarginProperty, AlertResourceKey.IconDefaultMargin); + infoIconStyle.Add(Layoutable.WidthProperty, AlertTokenResourceKey.IconSize); + infoIconStyle.Add(Layoutable.HeightProperty, AlertTokenResourceKey.IconSize); + infoIconStyle.Add(Layoutable.MarginProperty, AlertTokenResourceKey.IconDefaultMargin); infoIconStyle.Add(Layoutable.VerticalAlignmentProperty, VerticalAlignment.Center); wrapperStyle.Add(infoIconStyle); Add(wrapperStyle); @@ -186,9 +186,9 @@ internal class AlertTheme : BaseControlTheme // 不为空 var wrapperStyle = new Style(selector => selector.Nesting().Not(x=> x.PropertyEquals(Alert.DescriptionProperty, null))); var infoIconStyle = new Style(selector=> infoIconSelector); - infoIconStyle.Add(Layoutable.WidthProperty, AlertResourceKey.WithDescriptionIconSize); - infoIconStyle.Add(Layoutable.HeightProperty, AlertResourceKey.WithDescriptionIconSize); - infoIconStyle.Add(Layoutable.MarginProperty, AlertResourceKey.IconWithDescriptionMargin); + infoIconStyle.Add(Layoutable.WidthProperty, AlertTokenResourceKey.WithDescriptionIconSize); + infoIconStyle.Add(Layoutable.HeightProperty, AlertTokenResourceKey.WithDescriptionIconSize); + infoIconStyle.Add(Layoutable.MarginProperty, AlertTokenResourceKey.IconWithDescriptionMargin); infoIconStyle.Add(Layoutable.VerticalAlignmentProperty, VerticalAlignment.Top); wrapperStyle.Add(infoIconStyle); Add(wrapperStyle); @@ -276,9 +276,9 @@ internal class AlertTheme : BaseControlTheme Name = CloseBtnPart, }; - TokenResourceBinder.CreateTokenBinding(closeBtn, IconButton.WidthProperty, GlobalResourceKey.IconSizeSM); - TokenResourceBinder.CreateTokenBinding(closeBtn, IconButton.HeightProperty, GlobalResourceKey.IconSizeSM); - TokenResourceBinder.CreateTokenBinding(closeBtn, IconButton.MarginProperty, AlertResourceKey.ExtraElementMargin); + TokenResourceBinder.CreateTokenBinding(closeBtn, IconButton.WidthProperty, GlobalTokenResourceKey.IconSizeSM); + TokenResourceBinder.CreateTokenBinding(closeBtn, IconButton.HeightProperty, GlobalTokenResourceKey.IconSizeSM); + TokenResourceBinder.CreateTokenBinding(closeBtn, IconButton.MarginProperty, AlertTokenResourceKey.ExtraElementMargin); CreateTemplateParentBinding(closeBtn, IconButton.IsVisibleProperty, Alert.IsClosableProperty); CreateTemplateParentBinding(closeBtn, IconButton.IconProperty, Alert.CloseIconProperty); @@ -351,7 +351,7 @@ internal class AlertTheme : BaseControlTheme Padding = new Thickness(0), IsVisible = !string.IsNullOrEmpty(alert.Description) }; - TokenResourceBinder.CreateTokenBinding(descriptionLabel, Label.MarginProperty, GlobalResourceKey.MarginXS, BindingPriority.Template, + TokenResourceBinder.CreateTokenBinding(descriptionLabel, Label.MarginProperty, GlobalTokenResourceKey.MarginXS, BindingPriority.Template, o => { if (o is double value) { diff --git a/src/AtomUI.Controls/ArrowDecoratedBox/ArrowDecoratedBoxTheme.cs b/src/AtomUI.Controls/ArrowDecoratedBox/ArrowDecoratedBoxTheme.cs index 180ae7c..216bf89 100644 --- a/src/AtomUI.Controls/ArrowDecoratedBox/ArrowDecoratedBoxTheme.cs +++ b/src/AtomUI.Controls/ArrowDecoratedBox/ArrowDecoratedBoxTheme.cs @@ -44,12 +44,12 @@ public class ArrowDecoratedBoxTheme : BaseControlTheme protected override void BuildStyles() { var commonStyle = new Style(selector => selector.Nesting()); - commonStyle.Add(ArrowDecoratedBox.ForegroundProperty, GlobalResourceKey.ColorText); - commonStyle.Add(ArrowDecoratedBox.BackgroundProperty, GlobalResourceKey.ColorBgContainer); - commonStyle.Add(ArrowDecoratedBox.MinHeightProperty, GlobalResourceKey.ControlHeight); - commonStyle.Add(ArrowDecoratedBox.PaddingProperty, ArrowDecoratedBoxResourceKey.Padding); - commonStyle.Add(ArrowDecoratedBox.ArrowSizeProperty, ArrowDecoratedBoxResourceKey.ArrowSize); - commonStyle.Add(ArrowDecoratedBox.CornerRadiusProperty, GlobalResourceKey.BorderRadius); + commonStyle.Add(ArrowDecoratedBox.ForegroundProperty, GlobalTokenResourceKey.ColorText); + commonStyle.Add(ArrowDecoratedBox.BackgroundProperty, GlobalTokenResourceKey.ColorBgContainer); + commonStyle.Add(ArrowDecoratedBox.MinHeightProperty, GlobalTokenResourceKey.ControlHeight); + commonStyle.Add(ArrowDecoratedBox.PaddingProperty, ArrowDecoratedBoxTokenResourceKey.Padding); + commonStyle.Add(ArrowDecoratedBox.ArrowSizeProperty, ArrowDecoratedBoxTokenResourceKey.ArrowSize); + commonStyle.Add(ArrowDecoratedBox.CornerRadiusProperty, GlobalTokenResourceKey.BorderRadius); Add(commonStyle); } } \ No newline at end of file diff --git a/src/AtomUI.Controls/Badge/CountBadge.cs b/src/AtomUI.Controls/Badge/CountBadge.cs index 26134d9..d087c72 100644 --- a/src/AtomUI.Controls/Badge/CountBadge.cs +++ b/src/AtomUI.Controls/Badge/CountBadge.cs @@ -261,7 +261,7 @@ public class CountBadge : Control, IControlCustomStyle BindUtils.RelayBind(this, OverflowCountProperty, _badgeAdorner, CountBadgeAdorner.OverflowCountProperty); BindUtils.RelayBind(this, CountProperty, _badgeAdorner, CountBadgeAdorner.CountProperty); } - TokenResourceBinder.CreateTokenBinding(this, MotionDurationProperty, GlobalResourceKey.MotionDurationSlow); + TokenResourceBinder.CreateTokenBinding(this, MotionDurationProperty, GlobalTokenResourceKey.MotionDurationSlow); } private void HandleDecoratedTargetChanged() diff --git a/src/AtomUI.Controls/Badge/CountBadgeAdorner.cs b/src/AtomUI.Controls/Badge/CountBadgeAdorner.cs index 91589df..68c310c 100644 --- a/src/AtomUI.Controls/Badge/CountBadgeAdorner.cs +++ b/src/AtomUI.Controls/Badge/CountBadgeAdorner.cs @@ -201,23 +201,23 @@ internal class CountBadgeAdorner : Control, IControlCustomStyle void IControlCustomStyle.BuildStyles() { var commonStyle = new Style(); - commonStyle.Add(TextFontWeightProperty, BadgeResourceKey.TextFontWeight); - commonStyle.Add(BadgeColorProperty, BadgeResourceKey.BadgeColor); - commonStyle.Add(BadgeShadowSizeProperty, BadgeResourceKey.BadgeShadowSize); - commonStyle.Add(BadgeShadowColorProperty, BadgeResourceKey.BadgeShadowColor); - commonStyle.Add(BadgeTextColorProperty, BadgeResourceKey.BadgeTextColor); - commonStyle.Add(PaddingInlineProperty, GlobalResourceKey.PaddingXS); + commonStyle.Add(TextFontWeightProperty, BadgeTokenResourceKey.TextFontWeight); + commonStyle.Add(BadgeColorProperty, BadgeTokenResourceKey.BadgeColor); + commonStyle.Add(BadgeShadowSizeProperty, BadgeTokenResourceKey.BadgeShadowSize); + commonStyle.Add(BadgeShadowColorProperty, BadgeTokenResourceKey.BadgeShadowColor); + commonStyle.Add(BadgeTextColorProperty, BadgeTokenResourceKey.BadgeTextColor); + commonStyle.Add(PaddingInlineProperty, GlobalTokenResourceKey.PaddingXS); Styles.Add(commonStyle); var defaultSizeStyle = new Style(selector => selector.PropertyEquals(SizeProperty, CountBadgeSize.Default)); - defaultSizeStyle.Add(TextFontSizeProperty, BadgeResourceKey.TextFontSize); - defaultSizeStyle.Add(IndicatorHeightProperty, BadgeResourceKey.IndicatorHeight); + defaultSizeStyle.Add(TextFontSizeProperty, BadgeTokenResourceKey.TextFontSize); + defaultSizeStyle.Add(IndicatorHeightProperty, BadgeTokenResourceKey.IndicatorHeight); Styles.Add(defaultSizeStyle); var smallSizeStyle = new Style(selector => selector.PropertyEquals(SizeProperty, CountBadgeSize.Small)); - smallSizeStyle.Add(TextFontSizeProperty, BadgeResourceKey.TextFontSizeSM); - smallSizeStyle.Add(IndicatorHeightProperty, BadgeResourceKey.IndicatorHeightSM); + smallSizeStyle.Add(TextFontSizeProperty, BadgeTokenResourceKey.TextFontSizeSM); + smallSizeStyle.Add(IndicatorHeightProperty, BadgeTokenResourceKey.IndicatorHeightSM); Styles.Add(smallSizeStyle); } diff --git a/src/AtomUI.Controls/Badge/DotBadge.cs b/src/AtomUI.Controls/Badge/DotBadge.cs index 9159b76..844b78b 100644 --- a/src/AtomUI.Controls/Badge/DotBadge.cs +++ b/src/AtomUI.Controls/Badge/DotBadge.cs @@ -214,7 +214,7 @@ public partial class DotBadge : Control, IControlCustomStyle BindUtils.RelayBind(this, TextProperty, _dotBadgeAdorner, DotBadgeAdorner.TextProperty); BindUtils.RelayBind(this, OffsetProperty, _dotBadgeAdorner, DotBadgeAdorner.OffsetProperty); } - TokenResourceBinder.CreateTokenBinding(this, MotionDurationProperty, GlobalResourceKey.MotionDurationSlow); + TokenResourceBinder.CreateTokenBinding(this, MotionDurationProperty, GlobalTokenResourceKey.MotionDurationSlow); } private void HandleDecoratedTargetChanged() diff --git a/src/AtomUI.Controls/Badge/DotBadgeAdorner.cs b/src/AtomUI.Controls/Badge/DotBadgeAdorner.cs index a63fd91..5145b7e 100644 --- a/src/AtomUI.Controls/Badge/DotBadgeAdorner.cs +++ b/src/AtomUI.Controls/Badge/DotBadgeAdorner.cs @@ -175,31 +175,31 @@ internal partial class DotBadgeAdorner : Control, IControlCustomStyle private void BuildBadgeColorStyle() { var commonStyle = new Style(selector => selector.OfType()); - commonStyle.Add(BadgeTextMarginInlineProperty, GlobalResourceKey.MarginXS); - commonStyle.Add(BadgeDotColorProperty, BadgeResourceKey.BadgeColor); - commonStyle.Add(DotSizeProperty, BadgeResourceKey.DotSize); - commonStyle.Add(StatusSizeProperty, BadgeResourceKey.StatusSize); - commonStyle.Add(BadgeShadowSizeProperty, BadgeResourceKey.BadgeShadowSize); - commonStyle.Add(BadgeShadowColorProperty, BadgeResourceKey.BadgeShadowColor); + commonStyle.Add(BadgeTextMarginInlineProperty, GlobalTokenResourceKey.MarginXS); + commonStyle.Add(BadgeDotColorProperty, BadgeTokenResourceKey.BadgeColor); + commonStyle.Add(DotSizeProperty, BadgeTokenResourceKey.DotSize); + commonStyle.Add(StatusSizeProperty, BadgeTokenResourceKey.StatusSize); + commonStyle.Add(BadgeShadowSizeProperty, BadgeTokenResourceKey.BadgeShadowSize); + commonStyle.Add(BadgeShadowColorProperty, BadgeTokenResourceKey.BadgeShadowColor); var errorStatusStyle = new Style(selector => selector.Nesting().PropertyEquals(DotBadgeAdorner.StatusProperty, DotBadgeStatus.Error)); - errorStatusStyle.Add(DotBadgeAdorner.BadgeDotColorProperty, GlobalResourceKey.ColorError); + errorStatusStyle.Add(DotBadgeAdorner.BadgeDotColorProperty, GlobalTokenResourceKey.ColorError); commonStyle.Add(errorStatusStyle); var successStatusStyle = new Style(selector => selector.Nesting().PropertyEquals(DotBadgeAdorner.StatusProperty, DotBadgeStatus.Success)); - successStatusStyle.Add(DotBadgeAdorner.BadgeDotColorProperty, GlobalResourceKey.ColorSuccess); + successStatusStyle.Add(DotBadgeAdorner.BadgeDotColorProperty, GlobalTokenResourceKey.ColorSuccess); commonStyle.Add(successStatusStyle); var warningStatusStyle = new Style(selector => selector.Nesting().PropertyEquals(DotBadgeAdorner.StatusProperty, DotBadgeStatus.Warning)); - warningStatusStyle.Add(DotBadgeAdorner.BadgeDotColorProperty, GlobalResourceKey.ColorWarning); + warningStatusStyle.Add(DotBadgeAdorner.BadgeDotColorProperty, GlobalTokenResourceKey.ColorWarning); commonStyle.Add(warningStatusStyle); var defaultStatusStyle = new Style(selector => selector.Nesting().PropertyEquals(DotBadgeAdorner.StatusProperty, DotBadgeStatus.Default)); - defaultStatusStyle.Add(DotBadgeAdorner.BadgeDotColorProperty, GlobalResourceKey.ColorTextPlaceholder); + defaultStatusStyle.Add(DotBadgeAdorner.BadgeDotColorProperty, GlobalTokenResourceKey.ColorTextPlaceholder); commonStyle.Add(defaultStatusStyle); var processingStatusStyle = new Style(selector => selector.Nesting().PropertyEquals(DotBadgeAdorner.StatusProperty, DotBadgeStatus.Processing)); - processingStatusStyle.Add(DotBadgeAdorner.BadgeDotColorProperty, GlobalResourceKey.ColorInfo); + processingStatusStyle.Add(DotBadgeAdorner.BadgeDotColorProperty, GlobalTokenResourceKey.ColorInfo); commonStyle.Add(processingStatusStyle); Styles.Add(commonStyle); diff --git a/src/AtomUI.Controls/Badge/RibbonBadgeAdorner.cs b/src/AtomUI.Controls/Badge/RibbonBadgeAdorner.cs index f40796d..a722ed7 100644 --- a/src/AtomUI.Controls/Badge/RibbonBadgeAdorner.cs +++ b/src/AtomUI.Controls/Badge/RibbonBadgeAdorner.cs @@ -135,15 +135,15 @@ internal class RibbonBadgeAdorner : Control, IControlCustomStyle void IControlCustomStyle.BuildStyles() { var commonStyle = new Style(selector => selector.OfType()); - commonStyle.Add(RibbonColorProperty, GlobalResourceKey.ColorPrimary); - commonStyle.Add(CornerRadiusProperty, GlobalResourceKey.BorderRadiusSM); - commonStyle.Add(BadgeRibbonOffsetProperty, BadgeResourceKey.BadgeRibbonOffset); - commonStyle.Add(BadgeRibbonCornerTransformProperty, BadgeResourceKey.BadgeRibbonCornerTransform); - commonStyle.Add(BadgeRibbonCornerDarkenAmountProperty, BadgeResourceKey.BadgeRibbonCornerDarkenAmount); + commonStyle.Add(RibbonColorProperty, GlobalTokenResourceKey.ColorPrimary); + commonStyle.Add(CornerRadiusProperty, GlobalTokenResourceKey.BorderRadiusSM); + commonStyle.Add(BadgeRibbonOffsetProperty, BadgeTokenResourceKey.BadgeRibbonOffset); + commonStyle.Add(BadgeRibbonCornerTransformProperty, BadgeTokenResourceKey.BadgeRibbonCornerTransform); + commonStyle.Add(BadgeRibbonCornerDarkenAmountProperty, BadgeTokenResourceKey.BadgeRibbonCornerDarkenAmount); var labelStyle = new Style(selector => selector.Nesting().Child().OfType()); - labelStyle.Add(TextBlock.ForegroundProperty, GlobalResourceKey.ColorTextLightSolid); - labelStyle.Add(TextBlock.LineHeightProperty, BadgeResourceKey.BadgeFontHeight); - labelStyle.Add(TextBlock.PaddingProperty, BadgeResourceKey.BadgeRibbonTextPadding); + labelStyle.Add(TextBlock.ForegroundProperty, GlobalTokenResourceKey.ColorTextLightSolid); + labelStyle.Add(TextBlock.LineHeightProperty, BadgeTokenResourceKey.BadgeFontHeight); + labelStyle.Add(TextBlock.PaddingProperty, BadgeTokenResourceKey.BadgeRibbonTextPadding); commonStyle.Add(labelStyle); Styles.Add(commonStyle); } diff --git a/src/AtomUI.Controls/ButtonSpinner/ButtonSpinnerInnerBox.cs b/src/AtomUI.Controls/ButtonSpinner/ButtonSpinnerInnerBox.cs index 6d62570..b6ff3fb 100644 --- a/src/AtomUI.Controls/ButtonSpinner/ButtonSpinnerInnerBox.cs +++ b/src/AtomUI.Controls/ButtonSpinner/ButtonSpinnerInnerBox.cs @@ -115,10 +115,10 @@ internal class ButtonSpinnerInnerBox : AddOnDecoratedInnerBox, ICustomHitTest protected override void OnApplyTemplate(TemplateAppliedEventArgs e) { _handleContentPresenter = e.NameScope.Find(ButtonSpinnerInnerBoxTheme.SpinnerHandlePart); - TokenResourceBinder.CreateGlobalTokenBinding(this, SpinnerBorderThicknessProperty, GlobalResourceKey.BorderThickness, BindingPriority.Template, + TokenResourceBinder.CreateGlobalTokenBinding(this, SpinnerBorderThicknessProperty, GlobalTokenResourceKey.BorderThickness, BindingPriority.Template, new RenderScaleAwareThicknessConfigure(this)); - TokenResourceBinder.CreateGlobalTokenBinding(this, SpinnerBorderBrushProperty, GlobalResourceKey.ColorBorder); - TokenResourceBinder.CreateTokenBinding(this, SpinnerHandleWidthTokenProperty, ButtonSpinnerResourceKey.HandleWidth); + TokenResourceBinder.CreateGlobalTokenBinding(this, SpinnerBorderBrushProperty, GlobalTokenResourceKey.ColorBorder); + TokenResourceBinder.CreateTokenBinding(this, SpinnerHandleWidthTokenProperty, ButtonSpinnerTokenResourceKey.HandleWidth); base.OnApplyTemplate(e); } diff --git a/src/AtomUI.Controls/ButtonSpinner/ButtonSpinnerTheme.cs b/src/AtomUI.Controls/ButtonSpinner/ButtonSpinnerTheme.cs index c20785c..e78a230 100644 --- a/src/AtomUI.Controls/ButtonSpinner/ButtonSpinnerTheme.cs +++ b/src/AtomUI.Controls/ButtonSpinner/ButtonSpinnerTheme.cs @@ -87,15 +87,15 @@ internal class ButtonSpinnerTheme : BaseControlTheme spinnerHandleDecorator.Child = spinnerLayout; - TokenResourceBinder.CreateTokenBinding(spinnerLayout, StackPanel.WidthProperty, ButtonSpinnerResourceKey.HandleWidth); + TokenResourceBinder.CreateTokenBinding(spinnerLayout, StackPanel.WidthProperty, ButtonSpinnerTokenResourceKey.HandleWidth); var increaseButtonIcon = new PathIcon() { Kind = "UpOutlined" }; - TokenResourceBinder.CreateGlobalTokenBinding(increaseButtonIcon, PathIcon.ActiveFilledBrushProperty, ButtonSpinnerResourceKey.HandleHoverColor); - TokenResourceBinder.CreateGlobalTokenBinding(increaseButtonIcon, PathIcon.SelectedFilledBrushProperty, GlobalResourceKey.ColorPrimaryActive); + TokenResourceBinder.CreateGlobalTokenBinding(increaseButtonIcon, PathIcon.ActiveFilledBrushProperty, ButtonSpinnerTokenResourceKey.HandleHoverColor); + TokenResourceBinder.CreateGlobalTokenBinding(increaseButtonIcon, PathIcon.SelectedFilledBrushProperty, GlobalTokenResourceKey.ColorPrimaryActive); var increaseButton = new IconButton() { @@ -112,12 +112,12 @@ internal class ButtonSpinnerTheme : BaseControlTheme increaseButton.SetCurrentValue(IconButton.BackgroundProperty, new SolidColorBrush(Colors.Transparent)); { var handleButtonStyle = new Style(selector => selector.Class(StdPseudoClass.Pressed)); - handleButtonStyle.Add(IconButton.BackgroundProperty, ButtonSpinnerResourceKey.HandleActiveBg); + handleButtonStyle.Add(IconButton.BackgroundProperty, ButtonSpinnerTokenResourceKey.HandleActiveBg); increaseButton.Styles.Add(handleButtonStyle); } - TokenResourceBinder.CreateTokenBinding(increaseButton, IconButton.IconWidthProperty, ButtonSpinnerResourceKey.HandleIconSize); - TokenResourceBinder.CreateTokenBinding(increaseButton, IconButton.IconHeightProperty, ButtonSpinnerResourceKey.HandleIconSize); + TokenResourceBinder.CreateTokenBinding(increaseButton, IconButton.IconWidthProperty, ButtonSpinnerTokenResourceKey.HandleIconSize); + TokenResourceBinder.CreateTokenBinding(increaseButton, IconButton.IconHeightProperty, ButtonSpinnerTokenResourceKey.HandleIconSize); increaseButton.RegisterInNameScope(scope); var decreaseButtonIcon = new PathIcon() @@ -125,8 +125,8 @@ internal class ButtonSpinnerTheme : BaseControlTheme Kind = "DownOutlined" }; - TokenResourceBinder.CreateGlobalTokenBinding(decreaseButtonIcon, PathIcon.ActiveFilledBrushProperty, ButtonSpinnerResourceKey.HandleHoverColor); - TokenResourceBinder.CreateGlobalTokenBinding(decreaseButtonIcon, PathIcon.SelectedFilledBrushProperty, GlobalResourceKey.ColorPrimaryActive); + TokenResourceBinder.CreateGlobalTokenBinding(decreaseButtonIcon, PathIcon.ActiveFilledBrushProperty, ButtonSpinnerTokenResourceKey.HandleHoverColor); + TokenResourceBinder.CreateGlobalTokenBinding(decreaseButtonIcon, PathIcon.SelectedFilledBrushProperty, GlobalTokenResourceKey.ColorPrimaryActive); var decreaseButton = new IconButton() { @@ -143,12 +143,12 @@ internal class ButtonSpinnerTheme : BaseControlTheme decreaseButton.SetCurrentValue(IconButton.BackgroundProperty, new SolidColorBrush(Colors.Transparent)); { var handleButtonStyle = new Style(selector => selector.Class(StdPseudoClass.Pressed)); - handleButtonStyle.Add(IconButton.BackgroundProperty, ButtonSpinnerResourceKey.HandleActiveBg); + handleButtonStyle.Add(IconButton.BackgroundProperty, ButtonSpinnerTokenResourceKey.HandleActiveBg); decreaseButton.Styles.Add(handleButtonStyle); } decreaseButton.RegisterInNameScope(scope); - TokenResourceBinder.CreateTokenBinding(decreaseButton, IconButton.IconWidthProperty, ButtonSpinnerResourceKey.HandleIconSize); - TokenResourceBinder.CreateTokenBinding(decreaseButton, IconButton.IconHeightProperty, ButtonSpinnerResourceKey.HandleIconSize); + TokenResourceBinder.CreateTokenBinding(decreaseButton, IconButton.IconWidthProperty, ButtonSpinnerTokenResourceKey.HandleIconSize); + TokenResourceBinder.CreateTokenBinding(decreaseButton, IconButton.IconHeightProperty, ButtonSpinnerTokenResourceKey.HandleIconSize); spinnerLayout.Children.Add(increaseButton); spinnerLayout.Children.Add(decreaseButton); @@ -163,17 +163,17 @@ internal class ButtonSpinnerTheme : BaseControlTheme var commonStyle = new Style(selector => selector.Nesting()); var largeStyle = new Style(selector => selector.Nesting().PropertyEquals(AddOnDecoratedBox.SizeTypeProperty, SizeType.Large)); - largeStyle.Add(AddOnDecoratedBox.CornerRadiusProperty, GlobalResourceKey.BorderRadiusLG); + largeStyle.Add(AddOnDecoratedBox.CornerRadiusProperty, GlobalTokenResourceKey.BorderRadiusLG); commonStyle.Add(largeStyle); var middleStyle = new Style(selector => selector.Nesting().PropertyEquals(AddOnDecoratedBox.SizeTypeProperty, SizeType.Middle)); - middleStyle.Add(AddOnDecoratedBox.CornerRadiusProperty, GlobalResourceKey.BorderRadius); + middleStyle.Add(AddOnDecoratedBox.CornerRadiusProperty, GlobalTokenResourceKey.BorderRadius); commonStyle.Add(middleStyle); var smallStyle = new Style(selector => selector.Nesting().PropertyEquals(AddOnDecoratedBox.SizeTypeProperty, SizeType.Small)); - smallStyle.Add(AddOnDecoratedBox.CornerRadiusProperty, GlobalResourceKey.BorderRadiusSM); + smallStyle.Add(AddOnDecoratedBox.CornerRadiusProperty, GlobalTokenResourceKey.BorderRadiusSM); commonStyle.Add(smallStyle); Add(commonStyle); diff --git a/src/AtomUI.Controls/Buttons/BaseButtonTheme.cs b/src/AtomUI.Controls/Buttons/BaseButtonTheme.cs index 89c00c0..5904dc0 100644 --- a/src/AtomUI.Controls/Buttons/BaseButtonTheme.cs +++ b/src/AtomUI.Controls/Buttons/BaseButtonTheme.cs @@ -62,9 +62,9 @@ internal abstract class BaseButtonTheme : BaseControlTheme this.Add(Button.HorizontalAlignmentProperty, HorizontalAlignment.Left); this.Add(Button.VerticalAlignmentProperty, VerticalAlignment.Bottom); this.Add(Button.CursorProperty, new Cursor(StandardCursorType.Hand)); - this.Add(Button.DefaultShadowProperty, ButtonResourceKey.DefaultShadow); - this.Add(Button.PrimaryShadowProperty, ButtonResourceKey.PrimaryShadow); - this.Add(Button.DangerShadowProperty, ButtonResourceKey.DangerShadow); + this.Add(Button.DefaultShadowProperty, ButtonTokenResourceKey.DefaultShadow); + this.Add(Button.PrimaryShadowProperty, ButtonTokenResourceKey.PrimaryShadow); + this.Add(Button.DangerShadowProperty, ButtonTokenResourceKey.DangerShadow); BuildSizeStyle(); BuildIconSizeStyle(); @@ -74,37 +74,37 @@ internal abstract class BaseButtonTheme : BaseControlTheme private void BuildSizeStyle() { var largeSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(Button.SizeTypeProperty, SizeType.Large)); - largeSizeStyle.Add(Button.ControlHeightTokenProperty, GlobalResourceKey.ControlHeightLG); - largeSizeStyle.Add(Button.FontSizeProperty, ButtonResourceKey.ContentFontSizeLG); - largeSizeStyle.Add(Button.PaddingProperty, ButtonResourceKey.PaddingLG); - largeSizeStyle.Add(Button.CornerRadiusProperty, GlobalResourceKey.BorderRadiusLG); + largeSizeStyle.Add(Button.ControlHeightTokenProperty, GlobalTokenResourceKey.ControlHeightLG); + largeSizeStyle.Add(Button.FontSizeProperty, ButtonTokenResourceKey.ContentFontSizeLG); + largeSizeStyle.Add(Button.PaddingProperty, ButtonTokenResourceKey.PaddingLG); + largeSizeStyle.Add(Button.CornerRadiusProperty, GlobalTokenResourceKey.BorderRadiusLG); { var iconOnlyStyle = new Style(selector => selector.Nesting().Class(Button.IconOnlyPC)); - iconOnlyStyle.Add(Button.PaddingProperty, ButtonResourceKey.IconOnyPaddingLG); + iconOnlyStyle.Add(Button.PaddingProperty, ButtonTokenResourceKey.IconOnyPaddingLG); largeSizeStyle.Add(iconOnlyStyle); } Add(largeSizeStyle); var middleSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(Button.SizeTypeProperty, SizeType.Middle)); - middleSizeStyle.Add(Button.ControlHeightTokenProperty, GlobalResourceKey.ControlHeight); - middleSizeStyle.Add(Button.FontSizeProperty, ButtonResourceKey.ContentFontSize); - middleSizeStyle.Add(Button.PaddingProperty, ButtonResourceKey.Padding); - middleSizeStyle.Add(Button.CornerRadiusProperty, GlobalResourceKey.BorderRadius); + middleSizeStyle.Add(Button.ControlHeightTokenProperty, GlobalTokenResourceKey.ControlHeight); + middleSizeStyle.Add(Button.FontSizeProperty, ButtonTokenResourceKey.ContentFontSize); + middleSizeStyle.Add(Button.PaddingProperty, ButtonTokenResourceKey.Padding); + middleSizeStyle.Add(Button.CornerRadiusProperty, GlobalTokenResourceKey.BorderRadius); { var iconOnlyStyle = new Style(selector => selector.Nesting().Class(Button.IconOnlyPC)); - iconOnlyStyle.Add(Button.PaddingProperty, ButtonResourceKey.IconOnyPadding); + iconOnlyStyle.Add(Button.PaddingProperty, ButtonTokenResourceKey.IconOnyPadding); middleSizeStyle.Add(iconOnlyStyle); } Add(middleSizeStyle); var smallSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(Button.SizeTypeProperty, SizeType.Small)); - smallSizeStyle.Add(Button.ControlHeightTokenProperty, GlobalResourceKey.ControlHeightSM); - smallSizeStyle.Add(Button.FontSizeProperty, ButtonResourceKey.ContentFontSizeSM); - smallSizeStyle.Add(Button.PaddingProperty, ButtonResourceKey.PaddingSM); - smallSizeStyle.Add(Button.CornerRadiusProperty, GlobalResourceKey.BorderRadiusSM); + smallSizeStyle.Add(Button.ControlHeightTokenProperty, GlobalTokenResourceKey.ControlHeightSM); + smallSizeStyle.Add(Button.FontSizeProperty, ButtonTokenResourceKey.ContentFontSizeSM); + smallSizeStyle.Add(Button.PaddingProperty, ButtonTokenResourceKey.PaddingSM); + smallSizeStyle.Add(Button.CornerRadiusProperty, GlobalTokenResourceKey.BorderRadiusSM); { var iconOnlyStyle = new Style(selector => selector.Nesting().Class(Button.IconOnlyPC)); - iconOnlyStyle.Add(Button.PaddingProperty, ButtonResourceKey.IconOnyPaddingSM); + iconOnlyStyle.Add(Button.PaddingProperty, ButtonTokenResourceKey.IconOnyPaddingSM); smallSizeStyle.Add(iconOnlyStyle); } Add(smallSizeStyle); @@ -117,9 +117,9 @@ internal abstract class BaseButtonTheme : BaseControlTheme var largeSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(Button.SizeTypeProperty, SizeType.Large)); { var iconStyle = new Style(selector => selector.Nesting().Template().OfType()); - iconStyle.Add(PathIcon.WidthProperty, GlobalResourceKey.IconSizeLG); - iconStyle.Add(PathIcon.HeightProperty, GlobalResourceKey.IconSizeLG); - iconStyle.Add(PathIcon.MarginProperty, ButtonResourceKey.IconMargin); + iconStyle.Add(PathIcon.WidthProperty, GlobalTokenResourceKey.IconSizeLG); + iconStyle.Add(PathIcon.HeightProperty, GlobalTokenResourceKey.IconSizeLG); + iconStyle.Add(PathIcon.MarginProperty, ButtonTokenResourceKey.IconMargin); largeSizeStyle.Add(iconStyle); } Add(largeSizeStyle); @@ -127,9 +127,9 @@ internal abstract class BaseButtonTheme : BaseControlTheme var middleSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(Button.SizeTypeProperty, SizeType.Middle)); { var iconStyle = new Style(selector => selector.Nesting().Template().OfType()); - iconStyle.Add(PathIcon.WidthProperty, GlobalResourceKey.IconSize); - iconStyle.Add(PathIcon.HeightProperty, GlobalResourceKey.IconSize); - iconStyle.Add(PathIcon.MarginProperty, ButtonResourceKey.IconMargin); + iconStyle.Add(PathIcon.WidthProperty, GlobalTokenResourceKey.IconSize); + iconStyle.Add(PathIcon.HeightProperty, GlobalTokenResourceKey.IconSize); + iconStyle.Add(PathIcon.MarginProperty, ButtonTokenResourceKey.IconMargin); middleSizeStyle.Add(iconStyle); } @@ -138,9 +138,9 @@ internal abstract class BaseButtonTheme : BaseControlTheme var smallSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(Button.SizeTypeProperty, SizeType.Small)); { var iconStyle = new Style(selector => selector.Nesting().Template().OfType()); - iconStyle.Add(PathIcon.WidthProperty, GlobalResourceKey.IconSizeSM); - iconStyle.Add(PathIcon.HeightProperty, GlobalResourceKey.IconSizeSM); - iconStyle.Add(PathIcon.MarginProperty, ButtonResourceKey.IconMargin); + iconStyle.Add(PathIcon.WidthProperty, GlobalTokenResourceKey.IconSizeSM); + iconStyle.Add(PathIcon.HeightProperty, GlobalTokenResourceKey.IconSizeSM); + iconStyle.Add(PathIcon.MarginProperty, ButtonTokenResourceKey.IconMargin); smallSizeStyle.Add(iconStyle); } Add(smallSizeStyle); @@ -158,8 +158,8 @@ internal abstract class BaseButtonTheme : BaseControlTheme var largeSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(Button.SizeTypeProperty, SizeType.Large)); { var iconStyle = new Style(selector => selector.Nesting().Template().OfType()); - iconStyle.Add(PathIcon.WidthProperty, ButtonResourceKey.OnlyIconSizeLG); - iconStyle.Add(PathIcon.HeightProperty, ButtonResourceKey.OnlyIconSizeLG); + iconStyle.Add(PathIcon.WidthProperty, ButtonTokenResourceKey.OnlyIconSizeLG); + iconStyle.Add(PathIcon.HeightProperty, ButtonTokenResourceKey.OnlyIconSizeLG); largeSizeStyle.Add(iconStyle); } iconOnlyStyle.Add(largeSizeStyle); @@ -167,8 +167,8 @@ internal abstract class BaseButtonTheme : BaseControlTheme var middleSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(Button.SizeTypeProperty, SizeType.Middle)); { var iconStyle = new Style(selector => selector.Nesting().Template().OfType()); - iconStyle.Add(PathIcon.WidthProperty, ButtonResourceKey.OnlyIconSize); - iconStyle.Add(PathIcon.HeightProperty, ButtonResourceKey.OnlyIconSize); + iconStyle.Add(PathIcon.WidthProperty, ButtonTokenResourceKey.OnlyIconSize); + iconStyle.Add(PathIcon.HeightProperty, ButtonTokenResourceKey.OnlyIconSize); middleSizeStyle.Add(iconStyle); } iconOnlyStyle.Add(middleSizeStyle); @@ -176,8 +176,8 @@ internal abstract class BaseButtonTheme : BaseControlTheme var smallSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(Button.SizeTypeProperty, SizeType.Small)); { var iconStyle = new Style(selector => selector.Nesting().Template().OfType()); - iconStyle.Add(PathIcon.WidthProperty, ButtonResourceKey.OnlyIconSizeSM); - iconStyle.Add(PathIcon.HeightProperty, ButtonResourceKey.OnlyIconSizeSM); + iconStyle.Add(PathIcon.WidthProperty, ButtonTokenResourceKey.OnlyIconSizeSM); + iconStyle.Add(PathIcon.HeightProperty, ButtonTokenResourceKey.OnlyIconSizeSM); smallSizeStyle.Add(iconStyle); } iconOnlyStyle.Add(smallSizeStyle); @@ -187,7 +187,7 @@ internal abstract class BaseButtonTheme : BaseControlTheme var notIconOnyStyle = new Style(selector => selector.Nesting().Not(x => x.Nesting().Class(Button.IconOnlyPC))); { var iconStyle = new Style(selector => selector.Nesting().Template().OfType()); - iconStyle.Add(PathIcon.MarginProperty, ButtonResourceKey.IconMargin); + iconStyle.Add(PathIcon.MarginProperty, ButtonTokenResourceKey.IconMargin); notIconOnyStyle.Add(iconStyle); } @@ -218,7 +218,7 @@ internal abstract class BaseButtonTheme : BaseControlTheme loadingIconStyle.Add(PathIcon.LoadingAnimationProperty, IconAnimation.Spin); loadingStyle.Add(loadingIconStyle); } - loadingStyle.Add(Button.OpacityProperty, GlobalResourceKey.OpacityLoading); + loadingStyle.Add(Button.OpacityProperty, GlobalTokenResourceKey.OpacityLoading); Add(loadingStyle); } } \ No newline at end of file diff --git a/src/AtomUI.Controls/Buttons/Button.cs b/src/AtomUI.Controls/Buttons/Button.cs index db27b2d..e59fe40 100644 --- a/src/AtomUI.Controls/Buttons/Button.cs +++ b/src/AtomUI.Controls/Buttons/Button.cs @@ -281,7 +281,7 @@ public class Button : AvaloniaButton, void ApplyShapeStyleConfig() { if (Shape == ButtonShape.Circle) { - TokenResourceBinder.CreateTokenBinding(this, PaddingProperty, ButtonResourceKey.CirclePadding); + TokenResourceBinder.CreateTokenBinding(this, PaddingProperty, ButtonTokenResourceKey.CirclePadding); } } diff --git a/src/AtomUI.Controls/Buttons/DefaultButtonTheme.cs b/src/AtomUI.Controls/Buttons/DefaultButtonTheme.cs index 5ca5ec0..5ac34b1 100644 --- a/src/AtomUI.Controls/Buttons/DefaultButtonTheme.cs +++ b/src/AtomUI.Controls/Buttons/DefaultButtonTheme.cs @@ -22,7 +22,7 @@ internal class DefaultButtonTheme : BaseButtonTheme { base.BuildStyles(); - this.Add(Button.BorderThicknessProperty, GlobalResourceKey.BorderThickness); + this.Add(Button.BorderThicknessProperty, GlobalTokenResourceKey.BorderThickness); BuildIconStyle(); BuildEnabledStyle(); BuildDisabledStyle(); @@ -32,43 +32,43 @@ internal class DefaultButtonTheme : BaseButtonTheme { var enabledStyle = new Style(selector => selector.Nesting()); // 正常状态 - enabledStyle.Add(Button.BackgroundProperty, ButtonResourceKey.DefaultBg); - enabledStyle.Add(Button.BorderBrushProperty, ButtonResourceKey.DefaultBorderColor); - enabledStyle.Add(Button.ForegroundProperty, ButtonResourceKey.DefaultColor); + enabledStyle.Add(Button.BackgroundProperty, ButtonTokenResourceKey.DefaultBg); + enabledStyle.Add(Button.BorderBrushProperty, ButtonTokenResourceKey.DefaultBorderColor); + enabledStyle.Add(Button.ForegroundProperty, ButtonTokenResourceKey.DefaultColor); // 正常 hover { var hoverStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver)); - hoverStyle.Add(Button.BorderBrushProperty, ButtonResourceKey.DefaultHoverBorderColor); - hoverStyle.Add(Button.ForegroundProperty, ButtonResourceKey.DefaultHoverColor); + hoverStyle.Add(Button.BorderBrushProperty, ButtonTokenResourceKey.DefaultHoverBorderColor); + hoverStyle.Add(Button.ForegroundProperty, ButtonTokenResourceKey.DefaultHoverColor); enabledStyle.Add(hoverStyle); } // 正常按下 { var pressedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver).Class(StdPseudoClass.Pressed)); - pressedStyle.Add(Button.BorderBrushProperty, ButtonResourceKey.DefaultActiveBorderColor); - pressedStyle.Add(Button.ForegroundProperty, ButtonResourceKey.DefaultActiveColor); + pressedStyle.Add(Button.BorderBrushProperty, ButtonTokenResourceKey.DefaultActiveBorderColor); + pressedStyle.Add(Button.ForegroundProperty, ButtonTokenResourceKey.DefaultActiveColor); enabledStyle.Add(pressedStyle); } // 危险按钮状态 var dangerStyle = new Style(selector => selector.Nesting().PropertyEquals(Button.IsDangerProperty, true)); - dangerStyle.Add(Button.BorderBrushProperty, GlobalResourceKey.ColorError); - dangerStyle.Add(Button.ForegroundProperty, GlobalResourceKey.ColorError); + dangerStyle.Add(Button.BorderBrushProperty, GlobalTokenResourceKey.ColorError); + dangerStyle.Add(Button.ForegroundProperty, GlobalTokenResourceKey.ColorError); // 危险状态 hover { var hoverStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver)); - hoverStyle.Add(Button.BorderBrushProperty, GlobalResourceKey.ColorErrorBorderHover); - hoverStyle.Add(Button.ForegroundProperty, GlobalResourceKey.ColorErrorBorderHover); + hoverStyle.Add(Button.BorderBrushProperty, GlobalTokenResourceKey.ColorErrorBorderHover); + hoverStyle.Add(Button.ForegroundProperty, GlobalTokenResourceKey.ColorErrorBorderHover); dangerStyle.Add(hoverStyle); } // 危险状态按下 { var pressedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver).Class(StdPseudoClass.Pressed)); - pressedStyle.Add(Button.BorderBrushProperty, GlobalResourceKey.ColorErrorActive); - pressedStyle.Add(Button.ForegroundProperty, GlobalResourceKey.ColorErrorActive); + pressedStyle.Add(Button.BorderBrushProperty, GlobalTokenResourceKey.ColorErrorActive); + pressedStyle.Add(Button.ForegroundProperty, GlobalTokenResourceKey.ColorErrorActive); dangerStyle.Add(pressedStyle); } enabledStyle.Add(dangerStyle); @@ -82,10 +82,10 @@ internal class DefaultButtonTheme : BaseButtonTheme // 普通状态 { var iconStyle = new Style(selector => selector.Nesting().Template().OfType()); - iconStyle.Add(PathIcon.DisabledFilledBrushProperty, GlobalResourceKey.ColorTextDisabled); - iconStyle.Add(PathIcon.NormalFilledBrushProperty, ButtonResourceKey.DefaultColor); - iconStyle.Add(PathIcon.SelectedFilledBrushProperty, ButtonResourceKey.DefaultActiveColor); - iconStyle.Add(PathIcon.ActiveFilledBrushProperty, ButtonResourceKey.DefaultHoverColor); + iconStyle.Add(PathIcon.DisabledFilledBrushProperty, GlobalTokenResourceKey.ColorTextDisabled); + iconStyle.Add(PathIcon.NormalFilledBrushProperty, ButtonTokenResourceKey.DefaultColor); + iconStyle.Add(PathIcon.SelectedFilledBrushProperty, ButtonTokenResourceKey.DefaultActiveColor); + iconStyle.Add(PathIcon.ActiveFilledBrushProperty, ButtonTokenResourceKey.DefaultHoverColor); Add(iconStyle); } @@ -93,9 +93,9 @@ internal class DefaultButtonTheme : BaseButtonTheme var ghostStyle = new Style(selector => selector.Nesting().PropertyEquals(Button.IsGhostProperty, true)); { var iconStyle = new Style(selector => selector.Nesting().Template().OfType()); - iconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalResourceKey.ColorTextLightSolid); - iconStyle.Add(PathIcon.SelectedFilledBrushProperty, GlobalResourceKey.ColorPrimaryActive); - iconStyle.Add(PathIcon.ActiveFilledBrushProperty, GlobalResourceKey.ColorPrimaryHover); + iconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorTextLightSolid); + iconStyle.Add(PathIcon.SelectedFilledBrushProperty, GlobalTokenResourceKey.ColorPrimaryActive); + iconStyle.Add(PathIcon.ActiveFilledBrushProperty, GlobalTokenResourceKey.ColorPrimaryHover); ghostStyle.Add(iconStyle); } Add(ghostStyle); @@ -103,9 +103,9 @@ internal class DefaultButtonTheme : BaseButtonTheme var isDangerStyle = new Style(selector => selector.Nesting().PropertyEquals(Button.IsDangerProperty, true)); { var iconStyle = new Style(selector => selector.Nesting().Template().OfType()); - iconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalResourceKey.ColorError); - iconStyle.Add(PathIcon.SelectedFilledBrushProperty, GlobalResourceKey.ColorErrorActive); - iconStyle.Add(PathIcon.ActiveFilledBrushProperty, GlobalResourceKey.ColorErrorBorderHover); + iconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorError); + iconStyle.Add(PathIcon.SelectedFilledBrushProperty, GlobalTokenResourceKey.ColorErrorActive); + iconStyle.Add(PathIcon.ActiveFilledBrushProperty, GlobalTokenResourceKey.ColorErrorBorderHover); isDangerStyle.Add(iconStyle); } Add(isDangerStyle); @@ -116,45 +116,45 @@ internal class DefaultButtonTheme : BaseButtonTheme { var ghostStyle = new Style(selector => selector.Nesting().PropertyEquals(Button.IsGhostProperty, true)); // 正常状态 - ghostStyle.Add(Button.ForegroundProperty, GlobalResourceKey.ColorTextLightSolid); - ghostStyle.Add(Button.BorderBrushProperty, GlobalResourceKey.ColorTextLightSolid); - ghostStyle.Add(Button.BackgroundProperty, GlobalResourceKey.ColorTransparent); + ghostStyle.Add(Button.ForegroundProperty, GlobalTokenResourceKey.ColorTextLightSolid); + ghostStyle.Add(Button.BorderBrushProperty, GlobalTokenResourceKey.ColorTextLightSolid); + ghostStyle.Add(Button.BackgroundProperty, GlobalTokenResourceKey.ColorTransparent); // 正常 hover { var hoverStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver)); - hoverStyle.Add(Button.ForegroundProperty, GlobalResourceKey.ColorPrimaryHover); - hoverStyle.Add(Button.BorderBrushProperty, GlobalResourceKey.ColorPrimaryHover); + hoverStyle.Add(Button.ForegroundProperty, GlobalTokenResourceKey.ColorPrimaryHover); + hoverStyle.Add(Button.BorderBrushProperty, GlobalTokenResourceKey.ColorPrimaryHover); ghostStyle.Add(hoverStyle); } // 正常按下 { var pressedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver).Class(StdPseudoClass.Pressed)); - pressedStyle.Add(Button.ForegroundProperty, GlobalResourceKey.ColorPrimaryActive); - pressedStyle.Add(Button.BorderBrushProperty, GlobalResourceKey.ColorPrimaryActive); + pressedStyle.Add(Button.ForegroundProperty, GlobalTokenResourceKey.ColorPrimaryActive); + pressedStyle.Add(Button.BorderBrushProperty, GlobalTokenResourceKey.ColorPrimaryActive); ghostStyle.Add(pressedStyle); } // 危险按钮状态 var dangerStyle = new Style(selector => selector.Nesting().PropertyEquals(Button.IsDangerProperty, true)); - dangerStyle.Add(Button.BackgroundProperty, GlobalResourceKey.ColorTransparent); - dangerStyle.Add(Button.BorderBrushProperty, GlobalResourceKey.ColorError); - dangerStyle.Add(Button.ForegroundProperty, GlobalResourceKey.ColorError); + dangerStyle.Add(Button.BackgroundProperty, GlobalTokenResourceKey.ColorTransparent); + dangerStyle.Add(Button.BorderBrushProperty, GlobalTokenResourceKey.ColorError); + dangerStyle.Add(Button.ForegroundProperty, GlobalTokenResourceKey.ColorError); // 危险状态 hover { var hoverStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver)); - hoverStyle.Add(Button.BorderBrushProperty, GlobalResourceKey.ColorErrorBorderHover); - hoverStyle.Add(Button.ForegroundProperty, GlobalResourceKey.ColorErrorBorderHover); + hoverStyle.Add(Button.BorderBrushProperty, GlobalTokenResourceKey.ColorErrorBorderHover); + hoverStyle.Add(Button.ForegroundProperty, GlobalTokenResourceKey.ColorErrorBorderHover); dangerStyle.Add(hoverStyle); } // 危险状态按下 { var pressedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver).Class(StdPseudoClass.Pressed)); - pressedStyle.Add(Button.BorderBrushProperty, GlobalResourceKey.ColorErrorActive); - pressedStyle.Add(Button.ForegroundProperty, GlobalResourceKey.ColorErrorActive); + pressedStyle.Add(Button.BorderBrushProperty, GlobalTokenResourceKey.ColorErrorActive); + pressedStyle.Add(Button.ForegroundProperty, GlobalTokenResourceKey.ColorErrorActive); dangerStyle.Add(pressedStyle); } ghostStyle.Add(dangerStyle); @@ -164,9 +164,9 @@ internal class DefaultButtonTheme : BaseButtonTheme private void BuildDisabledStyle() { var disabledStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Disabled)); - disabledStyle.Add(Button.ForegroundProperty, GlobalResourceKey.ColorTextDisabled); - disabledStyle.Add(Button.BorderBrushProperty, ButtonResourceKey.BorderColorDisabled); - disabledStyle.Add(Button.BackgroundProperty, GlobalResourceKey.ColorBgContainerDisabled); + disabledStyle.Add(Button.ForegroundProperty, GlobalTokenResourceKey.ColorTextDisabled); + disabledStyle.Add(Button.BorderBrushProperty, ButtonTokenResourceKey.BorderColorDisabled); + disabledStyle.Add(Button.BackgroundProperty, GlobalTokenResourceKey.ColorBgContainerDisabled); Add(disabledStyle); } } \ No newline at end of file diff --git a/src/AtomUI.Controls/Buttons/LinkButtonTheme.cs b/src/AtomUI.Controls/Buttons/LinkButtonTheme.cs index 8d629a0..15472ff 100644 --- a/src/AtomUI.Controls/Buttons/LinkButtonTheme.cs +++ b/src/AtomUI.Controls/Buttons/LinkButtonTheme.cs @@ -31,10 +31,10 @@ internal class LinkButtonTheme : BaseButtonTheme // 普通状态 { var iconStyle = new Style(selector => selector.Nesting().Template().OfType()); - iconStyle.Add(PathIcon.DisabledFilledBrushProperty, GlobalResourceKey.ColorTextDisabled); - iconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalResourceKey.ColorLink); - iconStyle.Add(PathIcon.SelectedFilledBrushProperty, ButtonResourceKey.DefaultActiveColor); - iconStyle.Add(PathIcon.ActiveFilledBrushProperty, ButtonResourceKey.DefaultHoverColor); + iconStyle.Add(PathIcon.DisabledFilledBrushProperty, GlobalTokenResourceKey.ColorTextDisabled); + iconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorLink); + iconStyle.Add(PathIcon.SelectedFilledBrushProperty, ButtonTokenResourceKey.DefaultActiveColor); + iconStyle.Add(PathIcon.ActiveFilledBrushProperty, ButtonTokenResourceKey.DefaultHoverColor); Add(iconStyle); } @@ -42,9 +42,9 @@ internal class LinkButtonTheme : BaseButtonTheme var ghostStyle = new Style(selector => selector.Nesting().PropertyEquals(Button.IsGhostProperty, true)); { var iconStyle = new Style(selector => selector.Nesting().Template().OfType()); - iconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalResourceKey.ColorLink); - iconStyle.Add(PathIcon.SelectedFilledBrushProperty, GlobalResourceKey.ColorPrimaryActive); - iconStyle.Add(PathIcon.ActiveFilledBrushProperty, GlobalResourceKey.ColorPrimaryHover); + iconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorLink); + iconStyle.Add(PathIcon.SelectedFilledBrushProperty, GlobalTokenResourceKey.ColorPrimaryActive); + iconStyle.Add(PathIcon.ActiveFilledBrushProperty, GlobalTokenResourceKey.ColorPrimaryHover); ghostStyle.Add(iconStyle); } Add(ghostStyle); @@ -52,9 +52,9 @@ internal class LinkButtonTheme : BaseButtonTheme var isDangerStyle = new Style(selector => selector.Nesting().PropertyEquals(Button.IsDangerProperty, true)); { var iconStyle = new Style(selector => selector.Nesting().Template().OfType()); - iconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalResourceKey.ColorError); - iconStyle.Add(PathIcon.SelectedFilledBrushProperty, GlobalResourceKey.ColorErrorActive); - iconStyle.Add(PathIcon.ActiveFilledBrushProperty, GlobalResourceKey.ColorErrorBorderHover); + iconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorError); + iconStyle.Add(PathIcon.SelectedFilledBrushProperty, GlobalTokenResourceKey.ColorErrorActive); + iconStyle.Add(PathIcon.ActiveFilledBrushProperty, GlobalTokenResourceKey.ColorErrorBorderHover); isDangerStyle.Add(iconStyle); } Add(isDangerStyle); @@ -64,37 +64,37 @@ internal class LinkButtonTheme : BaseButtonTheme { var enabledStyle = new Style(selector => selector.Nesting()); // 正常状态 - enabledStyle.Add(Button.BackgroundProperty, new DynamicResourceExtension(ButtonResourceKey.DefaultBg)); - enabledStyle.Add(Button.ForegroundProperty, new DynamicResourceExtension(GlobalResourceKey.ColorLink)); + enabledStyle.Add(Button.BackgroundProperty, new DynamicResourceExtension(ButtonTokenResourceKey.DefaultBg)); + enabledStyle.Add(Button.ForegroundProperty, new DynamicResourceExtension(GlobalTokenResourceKey.ColorLink)); // 正常 hover { var hoverStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver)); - hoverStyle.Add(Button.ForegroundProperty, new DynamicResourceExtension(GlobalResourceKey.ColorLinkHover)); + hoverStyle.Add(Button.ForegroundProperty, new DynamicResourceExtension(GlobalTokenResourceKey.ColorLinkHover)); enabledStyle.Add(hoverStyle); } // 正常按下 { var pressedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver).Class(StdPseudoClass.Pressed)); - pressedStyle.Add(Button.ForegroundProperty, new DynamicResourceExtension(GlobalResourceKey.ColorLinkActive)); + pressedStyle.Add(Button.ForegroundProperty, new DynamicResourceExtension(GlobalTokenResourceKey.ColorLinkActive)); enabledStyle.Add(pressedStyle); } // 危险按钮状态 var dangerStyle = new Style(selector => selector.Nesting().PropertyEquals(Button.IsDangerProperty, true)); - dangerStyle.Add(Button.ForegroundProperty, new DynamicResourceExtension(GlobalResourceKey.ColorError)); + dangerStyle.Add(Button.ForegroundProperty, new DynamicResourceExtension(GlobalTokenResourceKey.ColorError)); // 危险状态 hover { var hoverStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver)); - hoverStyle.Add(Button.ForegroundProperty, new DynamicResourceExtension(GlobalResourceKey.ColorErrorHover)); + hoverStyle.Add(Button.ForegroundProperty, new DynamicResourceExtension(GlobalTokenResourceKey.ColorErrorHover)); dangerStyle.Add(hoverStyle); } // 危险状态按下 { var pressedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver).Class(StdPseudoClass.Pressed)); - pressedStyle.Add(Button.ForegroundProperty, new DynamicResourceExtension(GlobalResourceKey.ColorErrorActive)); + pressedStyle.Add(Button.ForegroundProperty, new DynamicResourceExtension(GlobalTokenResourceKey.ColorErrorActive)); dangerStyle.Add(pressedStyle); } enabledStyle.Add(dangerStyle); @@ -108,7 +108,7 @@ internal class LinkButtonTheme : BaseButtonTheme { var ghostStyle = new Style(selector => selector.Nesting().PropertyEquals(Button.IsGhostProperty, true)); // 正常状态 - ghostStyle.Add(Button.BackgroundProperty, new DynamicResourceExtension(GlobalResourceKey.ColorTransparent)); + ghostStyle.Add(Button.BackgroundProperty, new DynamicResourceExtension(GlobalTokenResourceKey.ColorTransparent)); Add(ghostStyle); } @@ -116,7 +116,7 @@ internal class LinkButtonTheme : BaseButtonTheme private void BuildDisabledStyle() { var disabledStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Disabled)); - disabledStyle.Add(Button.ForegroundProperty, new DynamicResourceExtension(GlobalResourceKey.ColorTextDisabled)); + disabledStyle.Add(Button.ForegroundProperty, new DynamicResourceExtension(GlobalTokenResourceKey.ColorTextDisabled)); Add(disabledStyle); } } \ No newline at end of file diff --git a/src/AtomUI.Controls/Buttons/PrimaryButtonTheme.cs b/src/AtomUI.Controls/Buttons/PrimaryButtonTheme.cs index 3c2fa7a..e65270e 100644 --- a/src/AtomUI.Controls/Buttons/PrimaryButtonTheme.cs +++ b/src/AtomUI.Controls/Buttons/PrimaryButtonTheme.cs @@ -33,38 +33,38 @@ internal class PrimaryButtonTheme : BaseButtonTheme var enabledStyle = new Style(selector => selector.Nesting()); // 正常状态 - enabledStyle.Add(Button.ForegroundProperty, ButtonResourceKey.PrimaryColor); - enabledStyle.Add(Button.BackgroundProperty, GlobalResourceKey.ColorPrimary); + enabledStyle.Add(Button.ForegroundProperty, ButtonTokenResourceKey.PrimaryColor); + enabledStyle.Add(Button.BackgroundProperty, GlobalTokenResourceKey.ColorPrimary); // 正常 hover { var hoverStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver)); - hoverStyle.Add(Button.BackgroundProperty, GlobalResourceKey.ColorPrimaryHover); + hoverStyle.Add(Button.BackgroundProperty, GlobalTokenResourceKey.ColorPrimaryHover); enabledStyle.Add(hoverStyle); } // 正常按下 { var pressedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver).Class(StdPseudoClass.Pressed)); - pressedStyle.Add(Button.BackgroundProperty, GlobalResourceKey.ColorPrimaryActive); + pressedStyle.Add(Button.BackgroundProperty, GlobalTokenResourceKey.ColorPrimaryActive); enabledStyle.Add(pressedStyle); } // 危险按钮状态 var dangerStyle = new Style(selector => selector.Nesting().PropertyEquals(Button.IsDangerProperty, true)); - dangerStyle.Add(Button.BackgroundProperty, GlobalResourceKey.ColorError); + dangerStyle.Add(Button.BackgroundProperty, GlobalTokenResourceKey.ColorError); // 危险状态 hover { var hoverStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver)); - hoverStyle.Add(Button.BackgroundProperty, GlobalResourceKey.ColorErrorHover); + hoverStyle.Add(Button.BackgroundProperty, GlobalTokenResourceKey.ColorErrorHover); dangerStyle.Add(hoverStyle); } // 危险状态按下 { var pressedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver).Class(StdPseudoClass.Pressed)); - pressedStyle.Add(Button.BackgroundProperty, GlobalResourceKey.ColorErrorActive); + pressedStyle.Add(Button.BackgroundProperty, GlobalTokenResourceKey.ColorErrorActive); dangerStyle.Add(pressedStyle); } enabledStyle.Add(dangerStyle); @@ -77,45 +77,45 @@ internal class PrimaryButtonTheme : BaseButtonTheme { var ghostStyle = new Style(selector => selector.Nesting().PropertyEquals(Button.IsGhostProperty, true)); ghostStyle.Add(Button.BackgroundProperty, new SolidColorBrush(Colors.Transparent)); - ghostStyle.Add(Button.BorderThicknessProperty, GlobalResourceKey.BorderThickness); + ghostStyle.Add(Button.BorderThicknessProperty, GlobalTokenResourceKey.BorderThickness); // 正常状态 - ghostStyle.Add(Button.ForegroundProperty, GlobalResourceKey.ColorPrimary); - ghostStyle.Add(Button.BorderBrushProperty, GlobalResourceKey.ColorPrimary); + ghostStyle.Add(Button.ForegroundProperty, GlobalTokenResourceKey.ColorPrimary); + ghostStyle.Add(Button.BorderBrushProperty, GlobalTokenResourceKey.ColorPrimary); // 正常 hover { var hoverStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver)); - hoverStyle.Add(Button.ForegroundProperty, GlobalResourceKey.ColorPrimaryHover); - hoverStyle.Add(Button.BorderBrushProperty, GlobalResourceKey.ColorPrimaryHover); + hoverStyle.Add(Button.ForegroundProperty, GlobalTokenResourceKey.ColorPrimaryHover); + hoverStyle.Add(Button.BorderBrushProperty, GlobalTokenResourceKey.ColorPrimaryHover); ghostStyle.Add(hoverStyle); } // 正常按下 { var pressedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver).Class(StdPseudoClass.Pressed)); - pressedStyle.Add(Button.ForegroundProperty, GlobalResourceKey.ColorPrimaryActive); - pressedStyle.Add(Button.BorderBrushProperty, GlobalResourceKey.ColorPrimaryActive); + pressedStyle.Add(Button.ForegroundProperty, GlobalTokenResourceKey.ColorPrimaryActive); + pressedStyle.Add(Button.BorderBrushProperty, GlobalTokenResourceKey.ColorPrimaryActive); ghostStyle.Add(pressedStyle); } // 危险按钮状态 var dangerStyle = new Style(selector => selector.Nesting().PropertyEquals(Button.IsDangerProperty, true)); - dangerStyle.Add(Button.ForegroundProperty, GlobalResourceKey.ColorError); - dangerStyle.Add(Button.BorderBrushProperty, GlobalResourceKey.ColorError); + dangerStyle.Add(Button.ForegroundProperty, GlobalTokenResourceKey.ColorError); + dangerStyle.Add(Button.BorderBrushProperty, GlobalTokenResourceKey.ColorError); // 危险按钮状态 hover { var hoverStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver)); - hoverStyle.Add(Button.ForegroundProperty, GlobalResourceKey.ColorErrorBorderHover); - hoverStyle.Add(Button.BorderBrushProperty, GlobalResourceKey.ColorErrorBorderHover); + hoverStyle.Add(Button.ForegroundProperty, GlobalTokenResourceKey.ColorErrorBorderHover); + hoverStyle.Add(Button.BorderBrushProperty, GlobalTokenResourceKey.ColorErrorBorderHover); dangerStyle.Add(hoverStyle); } // 危险状态按下 { var pressedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver).Class(StdPseudoClass.Pressed)); - pressedStyle.Add(Button.ForegroundProperty, GlobalResourceKey.ColorErrorActive); - pressedStyle.Add(Button.BorderBrushProperty, GlobalResourceKey.ColorErrorActive); + pressedStyle.Add(Button.ForegroundProperty, GlobalTokenResourceKey.ColorErrorActive); + pressedStyle.Add(Button.BorderBrushProperty, GlobalTokenResourceKey.ColorErrorActive); dangerStyle.Add(pressedStyle); } @@ -128,25 +128,25 @@ internal class PrimaryButtonTheme : BaseButtonTheme // 普通状态 { var iconStyle = new Style(selector => selector.Nesting().Template().OfType()); - iconStyle.Add(PathIcon.DisabledFilledBrushProperty, GlobalResourceKey.ColorTextDisabled); - iconStyle.Add(PathIcon.NormalFilledBrushProperty, ButtonResourceKey.PrimaryColor); + iconStyle.Add(PathIcon.DisabledFilledBrushProperty, GlobalTokenResourceKey.ColorTextDisabled); + iconStyle.Add(PathIcon.NormalFilledBrushProperty, ButtonTokenResourceKey.PrimaryColor); Add(iconStyle); } // ghost 状态 var ghostStyle = new Style(selector => selector.Nesting().PropertyEquals(Button.IsGhostProperty, true)); { var iconStyle = new Style(selector => selector.Nesting().Template().OfType()); - iconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalResourceKey.ColorPrimary); - iconStyle.Add(PathIcon.SelectedFilledBrushProperty, GlobalResourceKey.ColorPrimaryActive); - iconStyle.Add(PathIcon.ActiveFilledBrushProperty, GlobalResourceKey.ColorPrimaryHover); + iconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorPrimary); + iconStyle.Add(PathIcon.SelectedFilledBrushProperty, GlobalTokenResourceKey.ColorPrimaryActive); + iconStyle.Add(PathIcon.ActiveFilledBrushProperty, GlobalTokenResourceKey.ColorPrimaryHover); ghostStyle.Add(iconStyle); } var isDangerStyle = new Style(selector => selector.Nesting().PropertyEquals(Button.IsDangerProperty, true)); { var iconStyle = new Style(selector => selector.Nesting().Template().OfType()); - iconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalResourceKey.ColorError); - iconStyle.Add(PathIcon.SelectedFilledBrushProperty, GlobalResourceKey.ColorErrorActive); - iconStyle.Add(PathIcon.ActiveFilledBrushProperty, GlobalResourceKey.ColorErrorBorderHover); + iconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorError); + iconStyle.Add(PathIcon.SelectedFilledBrushProperty, GlobalTokenResourceKey.ColorErrorActive); + iconStyle.Add(PathIcon.ActiveFilledBrushProperty, GlobalTokenResourceKey.ColorErrorBorderHover); isDangerStyle.Add(iconStyle); } ghostStyle.Add(isDangerStyle); @@ -156,10 +156,10 @@ internal class PrimaryButtonTheme : BaseButtonTheme private void BuildDisabledStyle() { var disabledStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Disabled)); - disabledStyle.Add(Button.BorderThicknessProperty, GlobalResourceKey.BorderThickness); - disabledStyle.Add(Button.ForegroundProperty, GlobalResourceKey.ColorTextDisabled); - disabledStyle.Add(Button.BorderBrushProperty, ButtonResourceKey.BorderColorDisabled); - disabledStyle.Add(Button.BackgroundProperty, GlobalResourceKey.ColorBgContainerDisabled); + disabledStyle.Add(Button.BorderThicknessProperty, GlobalTokenResourceKey.BorderThickness); + disabledStyle.Add(Button.ForegroundProperty, GlobalTokenResourceKey.ColorTextDisabled); + disabledStyle.Add(Button.BorderBrushProperty, ButtonTokenResourceKey.BorderColorDisabled); + disabledStyle.Add(Button.BackgroundProperty, GlobalTokenResourceKey.ColorBgContainerDisabled); Add(disabledStyle); } } \ No newline at end of file diff --git a/src/AtomUI.Controls/Buttons/TextButtonTheme.cs b/src/AtomUI.Controls/Buttons/TextButtonTheme.cs index 0c1d8ec..11da6df 100644 --- a/src/AtomUI.Controls/Buttons/TextButtonTheme.cs +++ b/src/AtomUI.Controls/Buttons/TextButtonTheme.cs @@ -30,37 +30,37 @@ internal class TextButtonTheme : BaseButtonTheme { var enabledStyle = new Style(selector => selector.Nesting()); // 正常状态 - enabledStyle.Add(Button.BackgroundProperty, GlobalResourceKey.ColorTransparent); - enabledStyle.Add(Button.ForegroundProperty, ButtonResourceKey.DefaultColor); + enabledStyle.Add(Button.BackgroundProperty, GlobalTokenResourceKey.ColorTransparent); + enabledStyle.Add(Button.ForegroundProperty, ButtonTokenResourceKey.DefaultColor); // 正常 hover { var hoverStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver)); - hoverStyle.Add(Button.BackgroundProperty, ButtonResourceKey.TextHoverBg); + hoverStyle.Add(Button.BackgroundProperty, ButtonTokenResourceKey.TextHoverBg); enabledStyle.Add(hoverStyle); } // 正常按下 { var pressedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver).Class(StdPseudoClass.Pressed)); - pressedStyle.Add(Button.BackgroundProperty, GlobalResourceKey.ColorBgTextActive); + pressedStyle.Add(Button.BackgroundProperty, GlobalTokenResourceKey.ColorBgTextActive); enabledStyle.Add(pressedStyle); } // 危险按钮状态 var dangerStyle = new Style(selector => selector.Nesting().PropertyEquals(Button.IsDangerProperty, true)); - dangerStyle.Add(Button.ForegroundProperty, GlobalResourceKey.ColorError); + dangerStyle.Add(Button.ForegroundProperty, GlobalTokenResourceKey.ColorError); // 危险状态 hover { var hoverStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver)); - hoverStyle.Add(Button.BackgroundProperty, GlobalResourceKey.ColorErrorBgHover); + hoverStyle.Add(Button.BackgroundProperty, GlobalTokenResourceKey.ColorErrorBgHover); dangerStyle.Add(hoverStyle); } // 危险状态按下 { var pressedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver).Class(StdPseudoClass.Pressed)); - pressedStyle.Add(Button.BackgroundProperty, GlobalResourceKey.ColorErrorBgActive); + pressedStyle.Add(Button.BackgroundProperty, GlobalTokenResourceKey.ColorErrorBgActive); dangerStyle.Add(pressedStyle); } enabledStyle.Add(dangerStyle); @@ -72,19 +72,19 @@ internal class TextButtonTheme : BaseButtonTheme { { var iconStyle = new Style(selector => selector.Nesting().Template().OfType()); - iconStyle.Add(PathIcon.DisabledFilledBrushProperty, GlobalResourceKey.ColorTextDisabled); - iconStyle.Add(PathIcon.NormalFilledBrushProperty, ButtonResourceKey.DefaultColor); - iconStyle.Add(PathIcon.SelectedFilledBrushProperty, ButtonResourceKey.DefaultColor); - iconStyle.Add(PathIcon.ActiveFilledBrushProperty, ButtonResourceKey.DefaultColor); + iconStyle.Add(PathIcon.DisabledFilledBrushProperty, GlobalTokenResourceKey.ColorTextDisabled); + iconStyle.Add(PathIcon.NormalFilledBrushProperty, ButtonTokenResourceKey.DefaultColor); + iconStyle.Add(PathIcon.SelectedFilledBrushProperty, ButtonTokenResourceKey.DefaultColor); + iconStyle.Add(PathIcon.ActiveFilledBrushProperty, ButtonTokenResourceKey.DefaultColor); Add(iconStyle); } var isDangerStyle = new Style(selector => selector.Nesting().PropertyEquals(Button.IsDangerProperty, true)); { var iconStyle = new Style(selector => selector.Nesting().Template().OfType()); - iconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalResourceKey.ColorError); - iconStyle.Add(PathIcon.SelectedFilledBrushProperty, GlobalResourceKey.ColorErrorActive); - iconStyle.Add(PathIcon.ActiveFilledBrushProperty, GlobalResourceKey.ColorErrorBorderHover); + iconStyle.Add(PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorError); + iconStyle.Add(PathIcon.SelectedFilledBrushProperty, GlobalTokenResourceKey.ColorErrorActive); + iconStyle.Add(PathIcon.ActiveFilledBrushProperty, GlobalTokenResourceKey.ColorErrorBorderHover); isDangerStyle.Add(iconStyle); Add(isDangerStyle); } @@ -93,7 +93,7 @@ internal class TextButtonTheme : BaseButtonTheme private void BuildDisabledStyle() { var disabledStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Disabled)); - disabledStyle.Add(Button.ForegroundProperty, GlobalResourceKey.ColorTextDisabled); + disabledStyle.Add(Button.ForegroundProperty, GlobalTokenResourceKey.ColorTextDisabled); Add(disabledStyle); } } \ No newline at end of file diff --git a/src/AtomUI.Controls/CheckBox/CheckBox.cs b/src/AtomUI.Controls/CheckBox/CheckBox.cs index 706f382..681d45f 100644 --- a/src/AtomUI.Controls/CheckBox/CheckBox.cs +++ b/src/AtomUI.Controls/CheckBox/CheckBox.cs @@ -212,7 +212,7 @@ public class CheckBox : AvaloniaCheckBox, void IControlCustomStyle.HandleTemplateApplied(INameScope scope) { - TokenResourceBinder.CreateGlobalResourceBinding(this, IndicatorBorderThicknessProperty, GlobalResourceKey.BorderThickness, BindingPriority.Template, + TokenResourceBinder.CreateGlobalResourceBinding(this, IndicatorBorderThicknessProperty, GlobalTokenResourceKey.BorderThickness, BindingPriority.Template, new RenderScaleAwareThicknessConfigure(this)); HorizontalAlignment = HorizontalAlignment.Left; Cursor = new Cursor(StandardCursorType.Hand); @@ -280,7 +280,7 @@ public class CheckBox : AvaloniaCheckBox, AnimationUtils.CreateTransition(IndicatorBorderBrushProperty), AnimationUtils.CreateTransition(IndicatorTristateMarkBrushProperty), AnimationUtils.CreateTransition(IndicatorCheckedMarkEffectSizeProperty, - GlobalResourceKey.MotionDurationMid, new BackEaseOut()) + GlobalTokenResourceKey.MotionDurationMid, new BackEaseOut()) }; } diff --git a/src/AtomUI.Controls/CheckBox/CheckBoxTheme.cs b/src/AtomUI.Controls/CheckBox/CheckBoxTheme.cs index 5db3b81..abdf567 100644 --- a/src/AtomUI.Controls/CheckBox/CheckBoxTheme.cs +++ b/src/AtomUI.Controls/CheckBox/CheckBoxTheme.cs @@ -14,11 +14,11 @@ internal class CheckBoxTheme : BaseControlTheme protected override void BuildStyles() { - this.Add(CheckBox.CheckIndicatorSizeProperty, CheckBoxResourceKey.CheckIndicatorSize); - this.Add(CheckBox.PaddingInlineProperty, GlobalResourceKey.PaddingXS); - this.Add(CheckBox.IndicatorBorderRadiusProperty, GlobalResourceKey.BorderRadiusSM); - this.Add(CheckBox.IndicatorTristateMarkSizeProperty, CheckBoxResourceKey.IndicatorTristateMarkSize); - this.Add(CheckBox.IndicatorTristateMarkBrushProperty, GlobalResourceKey.ColorPrimary); + this.Add(CheckBox.CheckIndicatorSizeProperty, CheckBoxTokenResourceKey.CheckIndicatorSize); + this.Add(CheckBox.PaddingInlineProperty, GlobalTokenResourceKey.PaddingXS); + this.Add(CheckBox.IndicatorBorderRadiusProperty, GlobalTokenResourceKey.BorderRadiusSM); + this.Add(CheckBox.IndicatorTristateMarkSizeProperty, CheckBoxTokenResourceKey.IndicatorTristateMarkSize); + this.Add(CheckBox.IndicatorTristateMarkBrushProperty, GlobalTokenResourceKey.ColorPrimary); BuildEnabledStyle(); BuildDisabledStyle(); } @@ -26,16 +26,16 @@ internal class CheckBoxTheme : BaseControlTheme private void BuildDisabledStyle() { var disableStyle = new Style(selector => selector.Nesting().PropertyEquals(CheckBox.IsEnabledProperty, false)); - disableStyle.Add(CheckBox.IndicatorBackgroundProperty, GlobalResourceKey.ColorBgContainerDisabled); - disableStyle.Add(CheckBox.IndicatorBorderBrushProperty, GlobalResourceKey.ColorBorder); - disableStyle.Add(CheckBox.ForegroundProperty, GlobalResourceKey.ColorTextDisabled); + disableStyle.Add(CheckBox.IndicatorBackgroundProperty, GlobalTokenResourceKey.ColorBgContainerDisabled); + disableStyle.Add(CheckBox.IndicatorBorderBrushProperty, GlobalTokenResourceKey.ColorBorder); + disableStyle.Add(CheckBox.ForegroundProperty, GlobalTokenResourceKey.ColorTextDisabled); var checkedStyle = new Style(selector => selector.Nesting().PropertyEquals(CheckBox.IsCheckedProperty, true)); - checkedStyle.Add(CheckBox.IndicatorCheckedMarkBrushProperty, GlobalResourceKey.ColorTextDisabled); + checkedStyle.Add(CheckBox.IndicatorCheckedMarkBrushProperty, GlobalTokenResourceKey.ColorTextDisabled); disableStyle.Add(checkedStyle); var indeterminateStyle = new Style(selector => selector.Nesting().PropertyEquals(CheckBox.IsCheckedProperty, null)); - indeterminateStyle.Add(CheckBox.IndicatorTristateMarkBrushProperty, GlobalResourceKey.ColorTextDisabled); + indeterminateStyle.Add(CheckBox.IndicatorTristateMarkBrushProperty, GlobalTokenResourceKey.ColorTextDisabled); disableStyle.Add(indeterminateStyle); Add(disableStyle); } @@ -43,31 +43,31 @@ internal class CheckBoxTheme : BaseControlTheme private void BuildEnabledStyle() { var enabledStyle = new Style(selector => selector.Nesting().PropertyEquals(CheckBox.IsEnabledProperty, true)); - enabledStyle.Add(CheckBox.ForegroundProperty, GlobalResourceKey.ColorText); - enabledStyle.Add(CheckBox.IndicatorBackgroundProperty, GlobalResourceKey.ColorBgContainer); - enabledStyle.Add(CheckBox.IndicatorCheckedMarkBrushProperty, GlobalResourceKey.ColorBgContainer); - enabledStyle.Add(CheckBox.IndicatorBorderBrushProperty, GlobalResourceKey.ColorBorder); + enabledStyle.Add(CheckBox.ForegroundProperty, GlobalTokenResourceKey.ColorText); + enabledStyle.Add(CheckBox.IndicatorBackgroundProperty, GlobalTokenResourceKey.ColorBgContainer); + enabledStyle.Add(CheckBox.IndicatorCheckedMarkBrushProperty, GlobalTokenResourceKey.ColorBgContainer); + enabledStyle.Add(CheckBox.IndicatorBorderBrushProperty, GlobalTokenResourceKey.ColorBorder); // 选中 var checkedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Checked)); - checkedStyle.Add(CheckBox.IndicatorBackgroundProperty, GlobalResourceKey.ColorPrimary); - checkedStyle.Add(CheckBox.IndicatorBorderBrushProperty, GlobalResourceKey.ColorPrimary); + checkedStyle.Add(CheckBox.IndicatorBackgroundProperty, GlobalTokenResourceKey.ColorPrimary); + checkedStyle.Add(CheckBox.IndicatorBorderBrushProperty, GlobalTokenResourceKey.ColorPrimary); // 选中 hover var checkedHoverStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver)); - checkedHoverStyle.Add(CheckBox.IndicatorBackgroundProperty, GlobalResourceKey.ColorPrimaryHover); - checkedHoverStyle.Add(CheckBox.IndicatorBorderBrushProperty, GlobalResourceKey.ColorPrimaryHover); + checkedHoverStyle.Add(CheckBox.IndicatorBackgroundProperty, GlobalTokenResourceKey.ColorPrimaryHover); + checkedHoverStyle.Add(CheckBox.IndicatorBorderBrushProperty, GlobalTokenResourceKey.ColorPrimaryHover); checkedStyle.Add(checkedHoverStyle); enabledStyle.Add(checkedStyle); // 没选中 var unCheckedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver)); - unCheckedStyle.Add(CheckBox.IndicatorBorderBrushProperty, GlobalResourceKey.ColorPrimaryHover); + unCheckedStyle.Add(CheckBox.IndicatorBorderBrushProperty, GlobalTokenResourceKey.ColorPrimaryHover); enabledStyle.Add(unCheckedStyle); // 中间状态 var indeterminateStyle = new Style(selector => selector.Nesting().Class($"{StdPseudoClass.Indeterminate}{StdPseudoClass.PointerOver}")); - indeterminateStyle.Add(CheckBox.IndicatorBorderBrushProperty, GlobalResourceKey.ColorPrimaryHover); + indeterminateStyle.Add(CheckBox.IndicatorBorderBrushProperty, GlobalTokenResourceKey.ColorPrimaryHover); enabledStyle.Add(indeterminateStyle); Add(enabledStyle); diff --git a/src/AtomUI.Controls/Collapse/Collapse.cs b/src/AtomUI.Controls/Collapse/Collapse.cs index 9c5d77e..ba11d18 100644 --- a/src/AtomUI.Controls/Collapse/Collapse.cs +++ b/src/AtomUI.Controls/Collapse/Collapse.cs @@ -140,7 +140,7 @@ public class Collapse : SelectingItemsControl protected override void OnApplyTemplate(TemplateAppliedEventArgs e) { base.OnApplyTemplate(e); - TokenResourceBinder.CreateGlobalResourceBinding(this, BorderThicknessProperty, GlobalResourceKey.BorderThickness, + TokenResourceBinder.CreateGlobalResourceBinding(this, BorderThicknessProperty, GlobalTokenResourceKey.BorderThickness, BindingPriority.Template, new RenderScaleAwareThicknessConfigure(this)); SetupEffectiveBorderThickness(); SetupSelectionMode(); diff --git a/src/AtomUI.Controls/Collapse/CollapseItem.cs b/src/AtomUI.Controls/Collapse/CollapseItem.cs index 3b537c0..d0041d0 100644 --- a/src/AtomUI.Controls/Collapse/CollapseItem.cs +++ b/src/AtomUI.Controls/Collapse/CollapseItem.cs @@ -205,7 +205,7 @@ public class CollapseItem : HeaderedContentControl, ISelectable _animationTarget = e.NameScope.Find(CollapseItemTheme.ContentAnimationTargetPart); _headerDecorator = e.NameScope.Find(CollapseItemTheme.HeaderDecoratorPart); _expandButton = e.NameScope.Find(CollapseItemTheme.ExpandButtonPart); - TokenResourceBinder.CreateTokenBinding(this, MotionDurationProperty, GlobalResourceKey.MotionDurationSlow); + TokenResourceBinder.CreateTokenBinding(this, MotionDurationProperty, GlobalTokenResourceKey.MotionDurationSlow); SetupIconButton(); _enableAnimation = false; HandleSelectedChanged(); @@ -323,7 +323,7 @@ public class CollapseItem : HeaderedContentControl, ISelectable { Kind = "RightOutlined" }; - TokenResourceBinder.CreateGlobalTokenBinding(ExpandIcon, PathIcon.DisabledFilledBrushProperty, GlobalResourceKey.ColorTextDisabled); + TokenResourceBinder.CreateGlobalTokenBinding(ExpandIcon, PathIcon.DisabledFilledBrushProperty, GlobalTokenResourceKey.ColorTextDisabled); } UIStructureUtils.SetTemplateParent(ExpandIcon, this); } diff --git a/src/AtomUI.Controls/Collapse/CollapseItemTheme.cs b/src/AtomUI.Controls/Collapse/CollapseItemTheme.cs index bd7e0ec..07af69c 100644 --- a/src/AtomUI.Controls/Collapse/CollapseItemTheme.cs +++ b/src/AtomUI.Controls/Collapse/CollapseItemTheme.cs @@ -51,7 +51,7 @@ internal class CollapseItemTheme : BaseControlTheme }; animationPanel.Children.Add(contentPresenter); TokenResourceBinder.CreateGlobalTokenBinding(contentPresenter, ContentPresenter.BorderBrushProperty, - GlobalResourceKey.ColorBorder); + GlobalTokenResourceKey.ColorBorder); CreateTemplateParentBinding(contentPresenter, ContentPresenter.ContentProperty, CollapseItem.ContentProperty); CreateTemplateParentBinding(contentPresenter, ContentPresenter.ContentTemplateProperty, CollapseItem.ContentTemplateProperty); @@ -78,7 +78,7 @@ internal class CollapseItemTheme : BaseControlTheme DockPanel.SetDock(headerDecorator, Dock.Top); TokenResourceBinder.CreateGlobalTokenBinding(headerDecorator, Border.BorderBrushProperty, - GlobalResourceKey.ColorBorder); + GlobalTokenResourceKey.ColorBorder); CreateTemplateParentBinding(headerDecorator, Border.BorderThicknessProperty, CollapseItem.HeaderBorderThicknessProperty); @@ -98,8 +98,8 @@ internal class CollapseItemTheme : BaseControlTheme Name = ExpandButtonPart, VerticalAlignment = VerticalAlignment.Center, }; - TokenResourceBinder.CreateGlobalTokenBinding(expandButton, IconButton.IconWidthProperty, GlobalResourceKey.IconSize); - TokenResourceBinder.CreateGlobalTokenBinding(expandButton, IconButton.IconHeightProperty, GlobalResourceKey.IconSize); + TokenResourceBinder.CreateGlobalTokenBinding(expandButton, IconButton.IconWidthProperty, GlobalTokenResourceKey.IconSize); + TokenResourceBinder.CreateGlobalTokenBinding(expandButton, IconButton.IconHeightProperty, GlobalTokenResourceKey.IconSize); expandButton.RegisterInNameScope(scope); expandButton.Transitions = new Transitions(); expandButton.Transitions.Add( @@ -157,18 +157,18 @@ internal class CollapseItemTheme : BaseControlTheme { var commonStyle = new Style(selector => selector.Nesting()); var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(HeaderDecoratorPart)); - decoratorStyle.Add(Border.BackgroundProperty, CollapseResourceKey.HeaderBg); + decoratorStyle.Add(Border.BackgroundProperty, CollapseTokenResourceKey.HeaderBg); commonStyle.Add(decoratorStyle); var headerPresenter = new Style(selector => selector.Nesting().Template().Name(HeaderPresenterPart)); - headerPresenter.Add(ContentPresenter.ForegroundProperty, GlobalResourceKey.ColorTextHeading); + headerPresenter.Add(ContentPresenter.ForegroundProperty, GlobalTokenResourceKey.ColorTextHeading); commonStyle.Add(headerPresenter); // ExpandIcon var expandIconStyle = new Style(selector => selector.Nesting().Template().Name(ExpandButtonPart).Descendant().OfType()); - expandIconStyle.Add(PathIcon.WidthProperty, GlobalResourceKey.IconSizeSM); - expandIconStyle.Add(PathIcon.HeightProperty, GlobalResourceKey.IconSizeSM); + expandIconStyle.Add(PathIcon.WidthProperty, GlobalTokenResourceKey.IconSizeSM); + expandIconStyle.Add(PathIcon.HeightProperty, GlobalTokenResourceKey.IconSizeSM); commonStyle.Add(expandIconStyle); Add(commonStyle); @@ -193,15 +193,15 @@ internal class CollapseItemTheme : BaseControlTheme new Style(selector => selector.Nesting().PropertyEquals(CollapseItem.SizeTypeProperty, SizeType.Large)); { var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(HeaderDecoratorPart)); - decoratorStyle.Add(Border.PaddingProperty, CollapseResourceKey.CollapseHeaderPaddingLG); - decoratorStyle.Add(TextElement.FontSizeProperty, GlobalResourceKey.FontSizeLG); - decoratorStyle.Add(TextBlock.LineHeightProperty, GlobalResourceKey.FontHeightLG); + decoratorStyle.Add(Border.PaddingProperty, CollapseTokenResourceKey.CollapseHeaderPaddingLG); + decoratorStyle.Add(TextElement.FontSizeProperty, GlobalTokenResourceKey.FontSizeLG); + decoratorStyle.Add(TextBlock.LineHeightProperty, GlobalTokenResourceKey.FontHeightLG); largeSizeStyle.Add(decoratorStyle); } { var contentPresenterStyle = new Style(selector => selector.Nesting().Template().Name(ContentPresenterPart)); - contentPresenterStyle.Add(ContentPresenter.PaddingProperty, CollapseResourceKey.CollapseContentPaddingLG); + contentPresenterStyle.Add(ContentPresenter.PaddingProperty, CollapseTokenResourceKey.CollapseContentPaddingLG); largeSizeStyle.Add(contentPresenterStyle); } @@ -211,15 +211,15 @@ internal class CollapseItemTheme : BaseControlTheme new Style(selector => selector.Nesting().PropertyEquals(CollapseItem.SizeTypeProperty, SizeType.Middle)); { var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(HeaderDecoratorPart)); - decoratorStyle.Add(Border.PaddingProperty, CollapseResourceKey.HeaderPadding); - decoratorStyle.Add(TextElement.FontSizeProperty, GlobalResourceKey.FontSize); - decoratorStyle.Add(TextBlock.LineHeightProperty, GlobalResourceKey.FontHeight); + decoratorStyle.Add(Border.PaddingProperty, CollapseTokenResourceKey.HeaderPadding); + decoratorStyle.Add(TextElement.FontSizeProperty, GlobalTokenResourceKey.FontSize); + decoratorStyle.Add(TextBlock.LineHeightProperty, GlobalTokenResourceKey.FontHeight); middleSizeStyle.Add(decoratorStyle); } { var contentPresenterStyle = new Style(selector => selector.Nesting().Template().Name(ContentPresenterPart)); - contentPresenterStyle.Add(ContentPresenter.PaddingProperty, CollapseResourceKey.ContentPadding); + contentPresenterStyle.Add(ContentPresenter.PaddingProperty, CollapseTokenResourceKey.ContentPadding); middleSizeStyle.Add(contentPresenterStyle); } Add(middleSizeStyle); @@ -228,15 +228,15 @@ internal class CollapseItemTheme : BaseControlTheme new Style(selector => selector.Nesting().PropertyEquals(CollapseItem.SizeTypeProperty, SizeType.Small)); { var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(HeaderDecoratorPart)); - decoratorStyle.Add(Border.PaddingProperty, CollapseResourceKey.CollapseHeaderPaddingSM); - decoratorStyle.Add(TextElement.FontSizeProperty, GlobalResourceKey.FontSize); - decoratorStyle.Add(TextBlock.LineHeightProperty, GlobalResourceKey.FontHeight); + decoratorStyle.Add(Border.PaddingProperty, CollapseTokenResourceKey.CollapseHeaderPaddingSM); + decoratorStyle.Add(TextElement.FontSizeProperty, GlobalTokenResourceKey.FontSize); + decoratorStyle.Add(TextBlock.LineHeightProperty, GlobalTokenResourceKey.FontHeight); smallSizeStyle.Add(decoratorStyle); } { var contentPresenterStyle = new Style(selector => selector.Nesting().Template().Name(ContentPresenterPart)); - contentPresenterStyle.Add(ContentPresenter.PaddingProperty, CollapseResourceKey.CollapseContentPaddingSM); + contentPresenterStyle.Add(ContentPresenter.PaddingProperty, CollapseTokenResourceKey.CollapseContentPaddingSM); smallSizeStyle.Add(contentPresenterStyle); } @@ -272,7 +272,7 @@ internal class CollapseItemTheme : BaseControlTheme { var expandButtonStyle = new Style(selector => selector.Nesting().Template().Name(ExpandButtonPart)); expandButtonStyle.Add(Grid.ColumnProperty, 0); - expandButtonStyle.Add(IconButton.MarginProperty, CollapseResourceKey.LeftExpandButtonMargin); + expandButtonStyle.Add(IconButton.MarginProperty, CollapseTokenResourceKey.LeftExpandButtonMargin); startPositionStyle.Add(expandButtonStyle); } Add(startPositionStyle); @@ -283,7 +283,7 @@ internal class CollapseItemTheme : BaseControlTheme { var expandButtonStyle = new Style(selector => selector.Nesting().Template().Name(ExpandButtonPart)); expandButtonStyle.Add(Grid.ColumnProperty, 3); - expandButtonStyle.Add(IconButton.MarginProperty, CollapseResourceKey.RightExpandButtonMargin); + expandButtonStyle.Add(IconButton.MarginProperty, CollapseTokenResourceKey.RightExpandButtonMargin); endPositionStyle.Add(expandButtonStyle); } Add(endPositionStyle); @@ -294,7 +294,7 @@ internal class CollapseItemTheme : BaseControlTheme var borderlessStyle = new Style(selector => selector.Nesting().PropertyEquals(CollapseItem.IsBorderlessProperty, true)); var contentPresenterStyle = new Style(selector => selector.Nesting().Template().Name(ContentPresenterPart)); - contentPresenterStyle.Add(ContentPresenter.BackgroundProperty, CollapseResourceKey.HeaderBg); + contentPresenterStyle.Add(ContentPresenter.BackgroundProperty, CollapseTokenResourceKey.HeaderBg); borderlessStyle.Add(contentPresenterStyle); Add(borderlessStyle); } @@ -304,7 +304,7 @@ internal class CollapseItemTheme : BaseControlTheme var ghostStyle = new Style(selector => selector.Nesting().PropertyEquals(CollapseItem.IsGhostStyleProperty, true)); var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(HeaderDecoratorPart)); - decoratorStyle.Add(Border.BackgroundProperty, CollapseResourceKey.ContentBg); + decoratorStyle.Add(Border.BackgroundProperty, CollapseTokenResourceKey.ContentBg); ghostStyle.Add(decoratorStyle); Add(ghostStyle); } @@ -313,10 +313,10 @@ internal class CollapseItemTheme : BaseControlTheme { var disabledStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Disabled)); - disabledStyle.Add(CollapseItem.ForegroundProperty, GlobalResourceKey.ColorTextDisabled); + disabledStyle.Add(CollapseItem.ForegroundProperty, GlobalTokenResourceKey.ColorTextDisabled); var headerContentPresenterStyle = new Style(selector => selector.Nesting().Template().Name(HeaderDecoratorPart) .Descendant().OfType()); - headerContentPresenterStyle.Add(ContentPresenter.ForegroundProperty, GlobalResourceKey.ColorTextDisabled); + headerContentPresenterStyle.Add(ContentPresenter.ForegroundProperty, GlobalTokenResourceKey.ColorTextDisabled); disabledStyle.Add(headerContentPresenterStyle); Add(disabledStyle); @@ -326,8 +326,8 @@ internal class CollapseItemTheme : BaseControlTheme { var addOnContentStyle = new Style(selector => selector.Nesting().Template().Name(AddOnContentPresenterPart) .Descendant().OfType()); - addOnContentStyle.Add(PathIcon.WidthProperty, GlobalResourceKey.IconSize); - addOnContentStyle.Add(PathIcon.HeightProperty, GlobalResourceKey.IconSize); + addOnContentStyle.Add(PathIcon.WidthProperty, GlobalTokenResourceKey.IconSize); + addOnContentStyle.Add(PathIcon.HeightProperty, GlobalTokenResourceKey.IconSize); Add(addOnContentStyle); } } \ No newline at end of file diff --git a/src/AtomUI.Controls/Collapse/CollapseTheme.cs b/src/AtomUI.Controls/Collapse/CollapseTheme.cs index 2e1c41c..320f8d1 100644 --- a/src/AtomUI.Controls/Collapse/CollapseTheme.cs +++ b/src/AtomUI.Controls/Collapse/CollapseTheme.cs @@ -44,8 +44,8 @@ internal class CollapseTheme : BaseControlTheme protected override void BuildStyles() { var commonStyle = new Style(selector => selector.Nesting()); - commonStyle.Add(Collapse.BorderBrushProperty, GlobalResourceKey.ColorBorder); - commonStyle.Add(Collapse.CornerRadiusProperty, CollapseResourceKey.CollapsePanelBorderRadius); + commonStyle.Add(Collapse.BorderBrushProperty, GlobalTokenResourceKey.ColorBorder); + commonStyle.Add(Collapse.CornerRadiusProperty, CollapseTokenResourceKey.CollapsePanelBorderRadius); Add(commonStyle); } diff --git a/src/AtomUI.Controls/EmptyIndicator/EmptyIndicator.cs b/src/AtomUI.Controls/EmptyIndicator/EmptyIndicator.cs index 7056076..6bf0d45 100644 --- a/src/AtomUI.Controls/EmptyIndicator/EmptyIndicator.cs +++ b/src/AtomUI.Controls/EmptyIndicator/EmptyIndicator.cs @@ -114,10 +114,10 @@ public partial class EmptyIndicator : TemplatedControl, void IControlCustomStyle.SetupTokenBindings() { - TokenResourceBinder.CreateTokenBinding(this, ColorFillTokenProperty, GlobalResourceKey.ColorFill); - TokenResourceBinder.CreateTokenBinding(this, ColorFillTertiaryTokenProperty, GlobalResourceKey.ColorFillTertiary); - TokenResourceBinder.CreateTokenBinding(this, ColorFillQuaternaryTokenProperty, GlobalResourceKey.ColorFillQuaternary); - TokenResourceBinder.CreateTokenBinding(this, ColorBgContainerTokenProperty, GlobalResourceKey.ColorBgContainer); + TokenResourceBinder.CreateTokenBinding(this, ColorFillTokenProperty, GlobalTokenResourceKey.ColorFill); + TokenResourceBinder.CreateTokenBinding(this, ColorFillTertiaryTokenProperty, GlobalTokenResourceKey.ColorFillTertiary); + TokenResourceBinder.CreateTokenBinding(this, ColorFillQuaternaryTokenProperty, GlobalTokenResourceKey.ColorFillQuaternary); + TokenResourceBinder.CreateTokenBinding(this, ColorBgContainerTokenProperty, GlobalTokenResourceKey.ColorBgContainer); } private void SetupImage() diff --git a/src/AtomUI.Controls/EmptyIndicator/EmptyIndicatorTheme.cs b/src/AtomUI.Controls/EmptyIndicator/EmptyIndicatorTheme.cs index 8f3560e..1348668 100644 --- a/src/AtomUI.Controls/EmptyIndicator/EmptyIndicatorTheme.cs +++ b/src/AtomUI.Controls/EmptyIndicator/EmptyIndicatorTheme.cs @@ -44,7 +44,7 @@ internal class EmptyIndicatorTheme : BaseControlTheme Text = indicator.Description ?? "No data" }; - TokenResourceBinder.CreateTokenBinding(description, TextBlock.ForegroundProperty, GlobalResourceKey.ColorTextDescription); + TokenResourceBinder.CreateTokenBinding(description, TextBlock.ForegroundProperty, GlobalTokenResourceKey.ColorTextDescription); BindUtils.RelayBind(indicator, EmptyIndicator.DescriptionMarginProperty, description, TextBlock.MarginProperty, d => new Thickness(0, d, 0, 0)); layout.Children.Add(description); @@ -58,11 +58,11 @@ internal class EmptyIndicatorTheme : BaseControlTheme // 设置本身样式 var sizeSmallAndMiddleStyle = new Style(selector => Selectors.Or(selector.Nesting().PropertyEquals(EmptyIndicator.SizeTypeProperty, SizeType.Middle), selector.Nesting().PropertyEquals(EmptyIndicator.SizeTypeProperty, SizeType.Small))); - sizeSmallAndMiddleStyle.Add(EmptyIndicator.DescriptionMarginProperty, new DynamicResourceExtension(GlobalResourceKey.MarginXS)); + sizeSmallAndMiddleStyle.Add(EmptyIndicator.DescriptionMarginProperty, new DynamicResourceExtension(GlobalTokenResourceKey.MarginXS)); Add(sizeSmallAndMiddleStyle); var sizeLargeStyle = new Style(selector => selector.Nesting().PropertyEquals(EmptyIndicator.SizeTypeProperty, SizeType.Large)); - sizeLargeStyle.Add(EmptyIndicator.DescriptionMarginProperty, new DynamicResourceExtension(GlobalResourceKey.MarginSM)); + sizeLargeStyle.Add(EmptyIndicator.DescriptionMarginProperty, new DynamicResourceExtension(GlobalTokenResourceKey.MarginSM)); Add(sizeLargeStyle); BuildSvgStyle(); @@ -74,7 +74,7 @@ internal class EmptyIndicatorTheme : BaseControlTheme { var largeSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(EmptyIndicator.SizeTypeProperty, SizeType.Large)); var svgStyle = new Style(selector => svgSelector); - svgStyle.Add(Layoutable.HeightProperty, new DynamicResourceExtension(EmptyIndicatorResourceKey.EmptyImgHeight)); + svgStyle.Add(Layoutable.HeightProperty, new DynamicResourceExtension(EmptyIndicatorTokenResourceKey.EmptyImgHeight)); largeSizeStyle.Add(svgStyle); Add(largeSizeStyle); } @@ -82,7 +82,7 @@ internal class EmptyIndicatorTheme : BaseControlTheme { var middleSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(EmptyIndicator.SizeTypeProperty, SizeType.Middle)); var svgStyle = new Style(selector => svgSelector); - svgStyle.Add(Layoutable.HeightProperty, new DynamicResourceExtension(EmptyIndicatorResourceKey.EmptyImgHeightMD)); + svgStyle.Add(Layoutable.HeightProperty, new DynamicResourceExtension(EmptyIndicatorTokenResourceKey.EmptyImgHeightMD)); middleSizeStyle.Add(svgStyle); Add(middleSizeStyle); } @@ -90,7 +90,7 @@ internal class EmptyIndicatorTheme : BaseControlTheme { var smallSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(EmptyIndicator.SizeTypeProperty, SizeType.Small)); var svgStyle = new Style(selector => svgSelector); - svgStyle.Add(Layoutable.HeightProperty, new DynamicResourceExtension(EmptyIndicatorResourceKey.EmptyImgHeightSM)); + svgStyle.Add(Layoutable.HeightProperty, new DynamicResourceExtension(EmptyIndicatorTokenResourceKey.EmptyImgHeightSM)); smallSizeStyle.Add(svgStyle); Add(smallSizeStyle); } diff --git a/src/AtomUI.Controls/Expander/Expander.cs b/src/AtomUI.Controls/Expander/Expander.cs index 5d8dce8..adb97b0 100644 --- a/src/AtomUI.Controls/Expander/Expander.cs +++ b/src/AtomUI.Controls/Expander/Expander.cs @@ -177,8 +177,8 @@ public class Expander : AvaloniaExpander _animationTarget = e.NameScope.Find(ExpanderTheme.ContentAnimationTargetPart); _headerDecorator = e.NameScope.Find(ExpanderTheme.HeaderDecoratorPart); _expandButton = e.NameScope.Find(ExpanderTheme.ExpandButtonPart); - TokenResourceBinder.CreateTokenBinding(this, MotionDurationProperty, GlobalResourceKey.MotionDurationSlow); - TokenResourceBinder.CreateGlobalResourceBinding(this, BorderThicknessProperty, GlobalResourceKey.BorderThickness, + TokenResourceBinder.CreateTokenBinding(this, MotionDurationProperty, GlobalTokenResourceKey.MotionDurationSlow); + TokenResourceBinder.CreateGlobalResourceBinding(this, BorderThicknessProperty, GlobalTokenResourceKey.BorderThickness, BindingPriority.Template, new RenderScaleAwareThicknessConfigure(this)); SetupEffectiveBorderThickness(); SetupExpanderBorderThickness(); @@ -249,7 +249,7 @@ public class Expander : AvaloniaExpander { Kind = "RightOutlined" }; - TokenResourceBinder.CreateGlobalTokenBinding(ExpandIcon, PathIcon.DisabledFilledBrushProperty, GlobalResourceKey.ColorTextDisabled); + TokenResourceBinder.CreateGlobalTokenBinding(ExpandIcon, PathIcon.DisabledFilledBrushProperty, GlobalTokenResourceKey.ColorTextDisabled); } UIStructureUtils.SetTemplateParent(ExpandIcon, this); } diff --git a/src/AtomUI.Controls/Expander/ExpanderTheme.cs b/src/AtomUI.Controls/Expander/ExpanderTheme.cs index a43ed44..a2c6cff 100644 --- a/src/AtomUI.Controls/Expander/ExpanderTheme.cs +++ b/src/AtomUI.Controls/Expander/ExpanderTheme.cs @@ -63,7 +63,7 @@ internal class ExpanderTheme : BaseControlTheme }; animationPanel.SetCurrentValue(AnimationTargetPanel.IsVisibleProperty, false); animationPanel.Children.Add(contentPresenter); - TokenResourceBinder.CreateGlobalTokenBinding(contentPresenter, ContentPresenter.BorderBrushProperty, GlobalResourceKey.ColorBorder); + TokenResourceBinder.CreateGlobalTokenBinding(contentPresenter, ContentPresenter.BorderBrushProperty, GlobalTokenResourceKey.ColorBorder); CreateTemplateParentBinding(contentPresenter, ContentPresenter.ContentProperty, Expander.ContentProperty); CreateTemplateParentBinding(contentPresenter, ContentPresenter.ContentTemplateProperty, Expander.ContentTemplateProperty); @@ -108,8 +108,8 @@ internal class ExpanderTheme : BaseControlTheme VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Left, }; - TokenResourceBinder.CreateGlobalTokenBinding(expandButton, IconButton.IconWidthProperty, GlobalResourceKey.IconSize); - TokenResourceBinder.CreateGlobalTokenBinding(expandButton, IconButton.IconHeightProperty, GlobalResourceKey.IconSize); + TokenResourceBinder.CreateGlobalTokenBinding(expandButton, IconButton.IconWidthProperty, GlobalTokenResourceKey.IconSize); + TokenResourceBinder.CreateGlobalTokenBinding(expandButton, IconButton.IconHeightProperty, GlobalTokenResourceKey.IconSize); expandButton.RegisterInNameScope(scope); expandButton.Transitions = new Transitions(); @@ -166,32 +166,32 @@ internal class ExpanderTheme : BaseControlTheme var commonStyle = new Style(selector => selector.Nesting()); var frameDecoratorStyle = new Style(selector => selector.Nesting().Template().Name(FrameDecoratorPart)); - frameDecoratorStyle.Add(Border.BorderBrushProperty, GlobalResourceKey.ColorBorder); - frameDecoratorStyle.Add(Border.CornerRadiusProperty, ExpanderResourceKey.ExpanderBorderRadius); + frameDecoratorStyle.Add(Border.BorderBrushProperty, GlobalTokenResourceKey.ColorBorder); + frameDecoratorStyle.Add(Border.CornerRadiusProperty, ExpanderTokenResourceKey.ExpanderBorderRadius); commonStyle.Add(frameDecoratorStyle); { var headerDecoratorStyle = new Style(selector => selector.Nesting().Template().Name(HeaderDecoratorPart)); - headerDecoratorStyle.Add(Border.BackgroundProperty, ExpanderResourceKey.HeaderBg); - headerDecoratorStyle.Add(Border.BorderBrushProperty, GlobalResourceKey.ColorTransparent); + headerDecoratorStyle.Add(Border.BackgroundProperty, ExpanderTokenResourceKey.HeaderBg); + headerDecoratorStyle.Add(Border.BorderBrushProperty, GlobalTokenResourceKey.ColorTransparent); commonStyle.Add(headerDecoratorStyle); } var headerPresenter = new Style(selector => selector.Nesting().Template().Name(HeaderPresenterPart)); - headerPresenter.Add(ContentPresenter.ForegroundProperty, GlobalResourceKey.ColorTextHeading); + headerPresenter.Add(ContentPresenter.ForegroundProperty, GlobalTokenResourceKey.ColorTextHeading); commonStyle.Add(headerPresenter); // ExpandIcon var expandIconStyle = new Style(selector => selector.Nesting().Template().Name(ExpandButtonPart).Descendant().OfType()); - expandIconStyle.Add(PathIcon.WidthProperty, GlobalResourceKey.IconSizeSM); - expandIconStyle.Add(PathIcon.HeightProperty, GlobalResourceKey.IconSizeSM); + expandIconStyle.Add(PathIcon.WidthProperty, GlobalTokenResourceKey.IconSizeSM); + expandIconStyle.Add(PathIcon.HeightProperty, GlobalTokenResourceKey.IconSizeSM); commonStyle.Add(expandIconStyle); // 设置打开状态 var expandedStyle = new Style(selector => selector.Nesting().PropertyEquals(Expander.IsExpandedProperty, true)); { var headerDecoratorStyle = new Style(selector => selector.Nesting().Template().Name(HeaderDecoratorPart)); - headerDecoratorStyle.Add(Border.BorderBrushProperty, GlobalResourceKey.ColorBorder); + headerDecoratorStyle.Add(Border.BorderBrushProperty, GlobalTokenResourceKey.ColorBorder); expandedStyle.Add(headerDecoratorStyle); } commonStyle.Add(expandedStyle); @@ -206,7 +206,7 @@ internal class ExpanderTheme : BaseControlTheme { var expandButtonStyle = new Style(selector => selector.Nesting().Template().Name(ExpandButtonPart)); expandButtonStyle.Add(Grid.ColumnProperty, 0); - expandButtonStyle.Add(IconButton.MarginProperty, ExpanderResourceKey.LeftExpandButtonHMargin); + expandButtonStyle.Add(IconButton.MarginProperty, ExpanderTokenResourceKey.LeftExpandButtonHMargin); startPositionStyle.Add(expandButtonStyle); } Add(startPositionStyle); @@ -214,7 +214,7 @@ internal class ExpanderTheme : BaseControlTheme { var expandButtonStyle = new Style(selector => selector.Nesting().Template().Name(ExpandButtonPart)); expandButtonStyle.Add(Grid.ColumnProperty, 3); - expandButtonStyle.Add(IconButton.MarginProperty, ExpanderResourceKey.RightExpandButtonHMargin); + expandButtonStyle.Add(IconButton.MarginProperty, ExpanderTokenResourceKey.RightExpandButtonHMargin); endPositionStyle.Add(expandButtonStyle); } Add(endPositionStyle); @@ -363,15 +363,15 @@ internal class ExpanderTheme : BaseControlTheme var largeSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(Expander.SizeTypeProperty, SizeType.Large)); { var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(HeaderDecoratorPart)); - decoratorStyle.Add(Border.PaddingProperty, ExpanderResourceKey.HeaderPaddingLG); - decoratorStyle.Add(TextElement.FontSizeProperty, GlobalResourceKey.FontSizeLG); - decoratorStyle.Add(TextBlock.LineHeightProperty, GlobalResourceKey.FontHeightLG); + decoratorStyle.Add(Border.PaddingProperty, ExpanderTokenResourceKey.HeaderPaddingLG); + decoratorStyle.Add(TextElement.FontSizeProperty, GlobalTokenResourceKey.FontSizeLG); + decoratorStyle.Add(TextBlock.LineHeightProperty, GlobalTokenResourceKey.FontHeightLG); largeSizeStyle.Add(decoratorStyle); } { var contentPresenterStyle = new Style(selector => selector.Nesting().Template().Name(ContentPresenterPart)); - contentPresenterStyle.Add(ContentPresenter.PaddingProperty, ExpanderResourceKey.ContentPaddingLG); + contentPresenterStyle.Add(ContentPresenter.PaddingProperty, ExpanderTokenResourceKey.ContentPaddingLG); largeSizeStyle.Add(contentPresenterStyle); } @@ -380,15 +380,15 @@ internal class ExpanderTheme : BaseControlTheme var middleSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(Expander.SizeTypeProperty, SizeType.Middle)); { var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(HeaderDecoratorPart)); - decoratorStyle.Add(Border.PaddingProperty, ExpanderResourceKey.HeaderPadding); - decoratorStyle.Add(TextElement.FontSizeProperty, GlobalResourceKey.FontSize); - decoratorStyle.Add(TextBlock.LineHeightProperty, GlobalResourceKey.FontHeight); + decoratorStyle.Add(Border.PaddingProperty, ExpanderTokenResourceKey.HeaderPadding); + decoratorStyle.Add(TextElement.FontSizeProperty, GlobalTokenResourceKey.FontSize); + decoratorStyle.Add(TextBlock.LineHeightProperty, GlobalTokenResourceKey.FontHeight); middleSizeStyle.Add(decoratorStyle); } { var contentPresenterStyle = new Style(selector => selector.Nesting().Template().Name(ContentPresenterPart)); - contentPresenterStyle.Add(ContentPresenter.PaddingProperty, ExpanderResourceKey.ContentPadding); + contentPresenterStyle.Add(ContentPresenter.PaddingProperty, ExpanderTokenResourceKey.ContentPadding); middleSizeStyle.Add(contentPresenterStyle); } Add(middleSizeStyle); @@ -396,15 +396,15 @@ internal class ExpanderTheme : BaseControlTheme var smallSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(Expander.SizeTypeProperty, SizeType.Small)); { var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(HeaderDecoratorPart)); - decoratorStyle.Add(Border.PaddingProperty, ExpanderResourceKey.HeaderPaddingSM); - decoratorStyle.Add(TextElement.FontSizeProperty, GlobalResourceKey.FontSize); - decoratorStyle.Add(TextBlock.LineHeightProperty, GlobalResourceKey.FontHeight); + decoratorStyle.Add(Border.PaddingProperty, ExpanderTokenResourceKey.HeaderPaddingSM); + decoratorStyle.Add(TextElement.FontSizeProperty, GlobalTokenResourceKey.FontSize); + decoratorStyle.Add(TextBlock.LineHeightProperty, GlobalTokenResourceKey.FontHeight); smallSizeStyle.Add(decoratorStyle); } { var contentPresenterStyle = new Style(selector => selector.Nesting().Template().Name(ContentPresenterPart)); - contentPresenterStyle.Add(ContentPresenter.PaddingProperty, ExpanderResourceKey.ContentPaddingSM); + contentPresenterStyle.Add(ContentPresenter.PaddingProperty, ExpanderTokenResourceKey.ContentPaddingSM); smallSizeStyle.Add(contentPresenterStyle); } @@ -431,7 +431,7 @@ internal class ExpanderTheme : BaseControlTheme var borderlessStyle = new Style(selector => selector.Nesting().PropertyEquals(Expander.IsBorderlessProperty, true)); var contentPresenterStyle = new Style(selector => selector.Nesting().Template().Name(ContentPresenterPart)); - contentPresenterStyle.Add(ContentPresenter.BackgroundProperty, CollapseResourceKey.HeaderBg); + contentPresenterStyle.Add(ContentPresenter.BackgroundProperty, CollapseTokenResourceKey.HeaderBg); borderlessStyle.Add(contentPresenterStyle); Add(borderlessStyle); } @@ -441,7 +441,7 @@ internal class ExpanderTheme : BaseControlTheme var ghostStyle = new Style(selector => selector.Nesting().PropertyEquals(Expander.IsGhostStyleProperty, true)); var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(HeaderDecoratorPart)); - decoratorStyle.Add(Border.BackgroundProperty, ExpanderResourceKey.ContentBg); + decoratorStyle.Add(Border.BackgroundProperty, ExpanderTokenResourceKey.ContentBg); ghostStyle.Add(decoratorStyle); Add(ghostStyle); } @@ -450,9 +450,9 @@ internal class ExpanderTheme : BaseControlTheme { var disabledStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Disabled)); - disabledStyle.Add(Expander.ForegroundProperty, GlobalResourceKey.ColorTextDisabled); + disabledStyle.Add(Expander.ForegroundProperty, GlobalTokenResourceKey.ColorTextDisabled); var headerContentPresenterStyle = new Style(selector => selector.Nesting().Template().Name(HeaderDecoratorPart).Descendant().OfType()); - headerContentPresenterStyle.Add(ContentPresenter.ForegroundProperty, GlobalResourceKey.ColorTextDisabled); + headerContentPresenterStyle.Add(ContentPresenter.ForegroundProperty, GlobalTokenResourceKey.ColorTextDisabled); disabledStyle.Add(headerContentPresenterStyle); Add(disabledStyle); @@ -461,8 +461,8 @@ internal class ExpanderTheme : BaseControlTheme private void BuildAddOnContentStyle() { var addOnContentStyle = new Style(selector => selector.Nesting().Template().Name(AddOnContentPresenterPart).Descendant().OfType()); - addOnContentStyle.Add(PathIcon.WidthProperty, GlobalResourceKey.IconSize); - addOnContentStyle.Add(PathIcon.HeightProperty, GlobalResourceKey.IconSize); + addOnContentStyle.Add(PathIcon.WidthProperty, GlobalTokenResourceKey.IconSize); + addOnContentStyle.Add(PathIcon.HeightProperty, GlobalTokenResourceKey.IconSize); Add(addOnContentStyle); } diff --git a/src/AtomUI.Controls/Flyouts/Flyout.cs b/src/AtomUI.Controls/Flyouts/Flyout.cs index 8626290..b0e7729 100644 --- a/src/AtomUI.Controls/Flyouts/Flyout.cs +++ b/src/AtomUI.Controls/Flyouts/Flyout.cs @@ -117,8 +117,8 @@ public class Flyout : PopupFlyoutBase public Flyout() { - TokenResourceBinder.CreateGlobalTokenBinding(this, MotionDurationTokenProperty, GlobalResourceKey.MotionDurationMid); - TokenResourceBinder.CreateGlobalTokenBinding(this, MaskShadowsProperty, GlobalResourceKey.BoxShadowsSecondary); + TokenResourceBinder.CreateGlobalTokenBinding(this, MotionDurationTokenProperty, GlobalTokenResourceKey.MotionDurationMid); + TokenResourceBinder.CreateGlobalTokenBinding(this, MaskShadowsProperty, GlobalTokenResourceKey.BoxShadowsSecondary); } private void HandlePopupPropertyChanged(AvaloniaPropertyChangedEventArgs args) diff --git a/src/AtomUI.Controls/Flyouts/FlyoutHost.cs b/src/AtomUI.Controls/Flyouts/FlyoutHost.cs index b3376b2..2bb902f 100644 --- a/src/AtomUI.Controls/Flyouts/FlyoutHost.cs +++ b/src/AtomUI.Controls/Flyouts/FlyoutHost.cs @@ -162,7 +162,7 @@ public class FlyoutHost : Control ((ISetLogicalParent)AnchorTarget).SetParent(this); VisualChildren.Add(AnchorTarget); } - TokenResourceBinder.CreateGlobalTokenBinding(this, MarginToAnchorProperty, GlobalResourceKey.MarginXXS); + TokenResourceBinder.CreateGlobalTokenBinding(this, MarginToAnchorProperty, GlobalTokenResourceKey.MarginXXS); _initialized = true; } } diff --git a/src/AtomUI.Controls/Flyouts/MenuFlyoutPresenterTheme.cs b/src/AtomUI.Controls/Flyouts/MenuFlyoutPresenterTheme.cs index ac23c16..09509d5 100644 --- a/src/AtomUI.Controls/Flyouts/MenuFlyoutPresenterTheme.cs +++ b/src/AtomUI.Controls/Flyouts/MenuFlyoutPresenterTheme.cs @@ -28,13 +28,13 @@ public class MenuFlyoutPresenterTheme : BaseControlTheme ClipToBounds = false, UseLayoutRounding = false }; - TokenResourceBinder.CreateTokenBinding(wrapper, Border.BackgroundProperty, MenuResourceKey.MenuBgColor); - TokenResourceBinder.CreateTokenBinding(wrapper, Border.MinWidthProperty, MenuResourceKey.MenuPopupMinWidth); - TokenResourceBinder.CreateTokenBinding(wrapper, Border.MaxWidthProperty, MenuResourceKey.MenuPopupMaxWidth); - TokenResourceBinder.CreateTokenBinding(wrapper, Border.MinHeightProperty, MenuResourceKey.MenuPopupMinHeight); - TokenResourceBinder.CreateTokenBinding(wrapper, Border.MaxHeightProperty, MenuResourceKey.MenuPopupMaxHeight); - TokenResourceBinder.CreateTokenBinding(wrapper, Border.PaddingProperty, MenuResourceKey.MenuPopupContentPadding); - TokenResourceBinder.CreateTokenBinding(wrapper, Border.CornerRadiusProperty, MenuResourceKey.MenuPopupBorderRadius); + TokenResourceBinder.CreateTokenBinding(wrapper, Border.BackgroundProperty, MenuTokenResourceKey.MenuBgColor); + TokenResourceBinder.CreateTokenBinding(wrapper, Border.MinWidthProperty, MenuTokenResourceKey.MenuPopupMinWidth); + TokenResourceBinder.CreateTokenBinding(wrapper, Border.MaxWidthProperty, MenuTokenResourceKey.MenuPopupMaxWidth); + TokenResourceBinder.CreateTokenBinding(wrapper, Border.MinHeightProperty, MenuTokenResourceKey.MenuPopupMinHeight); + TokenResourceBinder.CreateTokenBinding(wrapper, Border.MaxHeightProperty, MenuTokenResourceKey.MenuPopupMaxHeight); + TokenResourceBinder.CreateTokenBinding(wrapper, Border.PaddingProperty, MenuTokenResourceKey.MenuPopupContentPadding); + TokenResourceBinder.CreateTokenBinding(wrapper, Border.CornerRadiusProperty, MenuTokenResourceKey.MenuPopupBorderRadius); var scrollViewer = new MenuScrollViewer(); var itemsPresenter = new ItemsPresenter @@ -53,6 +53,6 @@ public class MenuFlyoutPresenterTheme : BaseControlTheme protected override void BuildStyles() { this.Add(MenuFlyoutPresenter.BackgroundProperty, new SolidColorBrush(Colors.Transparent)); - this.Add(MenuFlyoutPresenter.CornerRadiusProperty, MenuResourceKey.MenuPopupBorderRadius); + this.Add(MenuFlyoutPresenter.CornerRadiusProperty, MenuTokenResourceKey.MenuPopupBorderRadius); } } \ No newline at end of file diff --git a/src/AtomUI.Controls/GeneratedFiles/AtomUI.Generator/AtomUI.Generator.TokenResourceKeyGenerator/TokenResourceConst.g.cs b/src/AtomUI.Controls/GeneratedFiles/AtomUI.Generator/AtomUI.Generator.TokenResourceKeyGenerator/TokenResourceConst.g.cs index 21d7d5e..30290e4 100644 --- a/src/AtomUI.Controls/GeneratedFiles/AtomUI.Generator/AtomUI.Generator.TokenResourceKeyGenerator/TokenResourceConst.g.cs +++ b/src/AtomUI.Controls/GeneratedFiles/AtomUI.Generator/AtomUI.Generator.TokenResourceKeyGenerator/TokenResourceConst.g.cs @@ -2,7 +2,7 @@ namespace AtomUI.Theme.Styling { - public static class AddOnDecoratedBoxResourceKey + public static class AddOnDecoratedBoxTokenResourceKey { public static readonly TokenResourceKey Padding = new TokenResourceKey("AddOnDecoratedBox.Padding", "AtomUI.Token"); public static readonly TokenResourceKey PaddingSM = new TokenResourceKey("AddOnDecoratedBox.PaddingSM", "AtomUI.Token"); @@ -25,7 +25,7 @@ namespace AtomUI.Theme.Styling public static readonly TokenResourceKey RightInnerAddOnMargin = new TokenResourceKey("AddOnDecoratedBox.RightInnerAddOnMargin", "AtomUI.Token"); } - public static class AlertResourceKey + public static class AlertTokenResourceKey { public static readonly TokenResourceKey DefaultPadding = new TokenResourceKey("Alert.DefaultPadding", "AtomUI.Token"); public static readonly TokenResourceKey WithDescriptionPadding = new TokenResourceKey("Alert.WithDescriptionPadding", "AtomUI.Token"); @@ -38,13 +38,13 @@ namespace AtomUI.Theme.Styling public static readonly TokenResourceKey ExtraElementMargin = new TokenResourceKey("Alert.ExtraElementMargin", "AtomUI.Token"); } - public static class ArrowDecoratedBoxResourceKey + public static class ArrowDecoratedBoxTokenResourceKey { public static readonly TokenResourceKey ArrowSize = new TokenResourceKey("ArrowDecoratedBox.ArrowSize", "AtomUI.Token"); public static readonly TokenResourceKey Padding = new TokenResourceKey("ArrowDecoratedBox.Padding", "AtomUI.Token"); } - public static class BadgeResourceKey + public static class BadgeTokenResourceKey { public static readonly TokenResourceKey IndicatorHeight = new TokenResourceKey("Badge.IndicatorHeight", "AtomUI.Token"); public static readonly TokenResourceKey IndicatorHeightSM = new TokenResourceKey("Badge.IndicatorHeightSM", "AtomUI.Token"); @@ -66,7 +66,7 @@ namespace AtomUI.Theme.Styling public static readonly TokenResourceKey BadgeRibbonTextPadding = new TokenResourceKey("Badge.BadgeRibbonTextPadding", "AtomUI.Token"); } - public static class ButtonSpinnerResourceKey + public static class ButtonSpinnerTokenResourceKey { public static readonly TokenResourceKey ControlWidth = new TokenResourceKey("ButtonSpinner.ControlWidth", "AtomUI.Token"); public static readonly TokenResourceKey HandleWidth = new TokenResourceKey("ButtonSpinner.HandleWidth", "AtomUI.Token"); @@ -78,7 +78,7 @@ namespace AtomUI.Theme.Styling public static readonly TokenResourceKey FilledHandleBg = new TokenResourceKey("ButtonSpinner.FilledHandleBg", "AtomUI.Token"); } - public static class ButtonResourceKey + public static class ButtonTokenResourceKey { public static readonly TokenResourceKey FontWeight = new TokenResourceKey("Button.FontWeight", "AtomUI.Token"); public static readonly TokenResourceKey DefaultShadow = new TokenResourceKey("Button.DefaultShadow", "AtomUI.Token"); @@ -125,13 +125,13 @@ namespace AtomUI.Theme.Styling public static readonly TokenResourceKey IconOnyPaddingSM = new TokenResourceKey("Button.IconOnyPaddingSM", "AtomUI.Token"); } - public static class CheckBoxResourceKey + public static class CheckBoxTokenResourceKey { public static readonly TokenResourceKey CheckIndicatorSize = new TokenResourceKey("CheckBox.CheckIndicatorSize", "AtomUI.Token"); public static readonly TokenResourceKey IndicatorTristateMarkSize = new TokenResourceKey("CheckBox.IndicatorTristateMarkSize", "AtomUI.Token"); } - public static class CollapseResourceKey + public static class CollapseTokenResourceKey { public static readonly TokenResourceKey HeaderPadding = new TokenResourceKey("Collapse.HeaderPadding", "AtomUI.Token"); public static readonly TokenResourceKey HeaderBg = new TokenResourceKey("Collapse.HeaderBg", "AtomUI.Token"); @@ -146,14 +146,14 @@ namespace AtomUI.Theme.Styling public static readonly TokenResourceKey RightExpandButtonMargin = new TokenResourceKey("Collapse.RightExpandButtonMargin", "AtomUI.Token"); } - public static class EmptyIndicatorResourceKey + public static class EmptyIndicatorTokenResourceKey { public static readonly TokenResourceKey EmptyImgHeight = new TokenResourceKey("EmptyIndicator.EmptyImgHeight", "AtomUI.Token"); public static readonly TokenResourceKey EmptyImgHeightSM = new TokenResourceKey("EmptyIndicator.EmptyImgHeightSM", "AtomUI.Token"); public static readonly TokenResourceKey EmptyImgHeightMD = new TokenResourceKey("EmptyIndicator.EmptyImgHeightMD", "AtomUI.Token"); } - public static class ExpanderResourceKey + public static class ExpanderTokenResourceKey { public static readonly TokenResourceKey HeaderPadding = new TokenResourceKey("Expander.HeaderPadding", "AtomUI.Token"); public static readonly TokenResourceKey HeaderPaddingSM = new TokenResourceKey("Expander.HeaderPaddingSM", "AtomUI.Token"); @@ -170,7 +170,7 @@ namespace AtomUI.Theme.Styling public static readonly TokenResourceKey RightExpandButtonVMargin = new TokenResourceKey("Expander.RightExpandButtonVMargin", "AtomUI.Token"); } - public static class LineEditResourceKey + public static class LineEditTokenResourceKey { public static readonly TokenResourceKey Padding = new TokenResourceKey("LineEdit.Padding", "AtomUI.Token"); public static readonly TokenResourceKey PaddingSM = new TokenResourceKey("LineEdit.PaddingSM", "AtomUI.Token"); @@ -193,7 +193,7 @@ namespace AtomUI.Theme.Styling public static readonly TokenResourceKey RightInnerAddOnMargin = new TokenResourceKey("LineEdit.RightInnerAddOnMargin", "AtomUI.Token"); } - public static class LoadingIndicatorResourceKey + public static class LoadingIndicatorTokenResourceKey { public static readonly TokenResourceKey DotSize = new TokenResourceKey("LoadingIndicator.DotSize", "AtomUI.Token"); public static readonly TokenResourceKey DotSizeSM = new TokenResourceKey("LoadingIndicator.DotSizeSM", "AtomUI.Token"); @@ -201,13 +201,13 @@ namespace AtomUI.Theme.Styling public static readonly TokenResourceKey IndicatorDuration = new TokenResourceKey("LoadingIndicator.IndicatorDuration", "AtomUI.Token"); } - public static class MarqueeLabelResourceKey + public static class MarqueeLabelTokenResourceKey { public static readonly TokenResourceKey CycleSpace = new TokenResourceKey("MarqueeLabel.CycleSpace", "AtomUI.Token"); public static readonly TokenResourceKey DefaultSpeed = new TokenResourceKey("MarqueeLabel.DefaultSpeed", "AtomUI.Token"); } - public static class MenuResourceKey + public static class MenuTokenResourceKey { public static readonly TokenResourceKey MenuPopupBorderRadius = new TokenResourceKey("Menu.MenuPopupBorderRadius", "AtomUI.Token"); public static readonly TokenResourceKey MenuPopupBoxShadows = new TokenResourceKey("Menu.MenuPopupBoxShadows", "AtomUI.Token"); @@ -257,7 +257,7 @@ namespace AtomUI.Theme.Styling public static readonly TokenResourceKey SeparatorItemHeight = new TokenResourceKey("Menu.SeparatorItemHeight", "AtomUI.Token"); } - public static class OptionButtonResourceKey + public static class OptionButtonTokenResourceKey { public static readonly TokenResourceKey ButtonBackground = new TokenResourceKey("OptionButton.ButtonBackground", "AtomUI.Token"); public static readonly TokenResourceKey ButtonCheckedBackground = new TokenResourceKey("OptionButton.ButtonCheckedBackground", "AtomUI.Token"); @@ -280,7 +280,7 @@ namespace AtomUI.Theme.Styling public static readonly TokenResourceKey PaddingSM = new TokenResourceKey("OptionButton.PaddingSM", "AtomUI.Token"); } - public static class ProgressBarResourceKey + public static class ProgressBarTokenResourceKey { public static readonly TokenResourceKey DefaultColor = new TokenResourceKey("ProgressBar.DefaultColor", "AtomUI.Token"); public static readonly TokenResourceKey RemainingColor = new TokenResourceKey("ProgressBar.RemainingColor", "AtomUI.Token"); @@ -297,7 +297,7 @@ namespace AtomUI.Theme.Styling public static readonly TokenResourceKey LineInfoIconSizeSM = new TokenResourceKey("ProgressBar.LineInfoIconSizeSM", "AtomUI.Token"); } - public static class RadioButtonResourceKey + public static class RadioButtonTokenResourceKey { public static readonly TokenResourceKey RadioSize = new TokenResourceKey("RadioButton.RadioSize", "AtomUI.Token"); public static readonly TokenResourceKey DotSize = new TokenResourceKey("RadioButton.DotSize", "AtomUI.Token"); @@ -307,7 +307,7 @@ namespace AtomUI.Theme.Styling public static readonly TokenResourceKey DotPadding = new TokenResourceKey("RadioButton.DotPadding", "AtomUI.Token"); } - public static class SegmentedResourceKey + public static class SegmentedTokenResourceKey { public static readonly TokenResourceKey ItemColor = new TokenResourceKey("Segmented.ItemColor", "AtomUI.Token"); public static readonly TokenResourceKey ItemHoverColor = new TokenResourceKey("Segmented.ItemHoverColor", "AtomUI.Token"); @@ -322,14 +322,14 @@ namespace AtomUI.Theme.Styling public static readonly TokenResourceKey SegmentedTextLabelMargin = new TokenResourceKey("Segmented.SegmentedTextLabelMargin", "AtomUI.Token"); } - public static class SeparatorResourceKey + public static class SeparatorTokenResourceKey { public static readonly TokenResourceKey TextPaddingInline = new TokenResourceKey("Separator.TextPaddingInline", "AtomUI.Token"); public static readonly TokenResourceKey OrientationMarginPercent = new TokenResourceKey("Separator.OrientationMarginPercent", "AtomUI.Token"); public static readonly TokenResourceKey VerticalMarginInline = new TokenResourceKey("Separator.VerticalMarginInline", "AtomUI.Token"); } - public static class SliderResourceKey + public static class SliderTokenResourceKey { public static readonly TokenResourceKey SliderTrackSize = new TokenResourceKey("Slider.SliderTrackSize", "AtomUI.Token"); public static readonly TokenResourceKey RailSize = new TokenResourceKey("Slider.RailSize", "AtomUI.Token"); @@ -358,7 +358,7 @@ namespace AtomUI.Theme.Styling public static readonly TokenResourceKey MarginPartWithMark = new TokenResourceKey("Slider.MarginPartWithMark", "AtomUI.Token"); } - public static class ToggleSwitchResourceKey + public static class ToggleSwitchTokenResourceKey { public static readonly TokenResourceKey TrackHeight = new TokenResourceKey("ToggleSwitch.TrackHeight", "AtomUI.Token"); public static readonly TokenResourceKey TrackHeightSM = new TokenResourceKey("ToggleSwitch.TrackHeightSM", "AtomUI.Token"); @@ -384,7 +384,7 @@ namespace AtomUI.Theme.Styling public static readonly TokenResourceKey ExtraInfoFontSizeSM = new TokenResourceKey("ToggleSwitch.ExtraInfoFontSizeSM", "AtomUI.Token"); } - public static class TabControlResourceKey + public static class TabControlTokenResourceKey { public static readonly TokenResourceKey CardBg = new TokenResourceKey("TabControl.CardBg", "AtomUI.Token"); public static readonly TokenResourceKey CardSize = new TokenResourceKey("TabControl.CardSize", "AtomUI.Token"); @@ -417,7 +417,7 @@ namespace AtomUI.Theme.Styling public static readonly TokenResourceKey TabAndContentGutter = new TokenResourceKey("TabControl.TabAndContentGutter", "AtomUI.Token"); } - public static class TagResourceKey + public static class TagTokenResourceKey { public static readonly TokenResourceKey DefaultBg = new TokenResourceKey("Tag.DefaultBg", "AtomUI.Token"); public static readonly TokenResourceKey DefaultColor = new TokenResourceKey("Tag.DefaultColor", "AtomUI.Token"); @@ -430,7 +430,7 @@ namespace AtomUI.Theme.Styling public static readonly TokenResourceKey TagBorderlessBg = new TokenResourceKey("Tag.TagBorderlessBg", "AtomUI.Token"); } - public static class ToolTipResourceKey + public static class ToolTipTokenResourceKey { public static readonly TokenResourceKey ToolTipMaxWidth = new TokenResourceKey("ToolTip.ToolTipMaxWidth", "AtomUI.Token"); public static readonly TokenResourceKey ToolTipColor = new TokenResourceKey("ToolTip.ToolTipColor", "AtomUI.Token"); @@ -443,7 +443,7 @@ namespace AtomUI.Theme.Styling public static readonly TokenResourceKey ToolTipArrowSize = new TokenResourceKey("ToolTip.ToolTipArrowSize", "AtomUI.Token"); } - public static class TreeViewResourceKey + public static class TreeViewTokenResourceKey { public static readonly TokenResourceKey TitleHeight = new TokenResourceKey("TreeView.TitleHeight", "AtomUI.Token"); public static readonly TokenResourceKey NodeHoverBg = new TokenResourceKey("TreeView.NodeHoverBg", "AtomUI.Token"); @@ -457,7 +457,7 @@ namespace AtomUI.Theme.Styling public static readonly TokenResourceKey DragIndicatorLineWidth = new TokenResourceKey("TreeView.DragIndicatorLineWidth", "AtomUI.Token"); } - public static class CaptionButtonResourceKey + public static class CaptionButtonTokenResourceKey { public static readonly TokenResourceKey HoverBackgroundColor = new TokenResourceKey("CaptionButton.HoverBackgroundColor", "AtomUI.Token"); public static readonly TokenResourceKey PressedBackgroundColor = new TokenResourceKey("CaptionButton.PressedBackgroundColor", "AtomUI.Token"); @@ -466,7 +466,7 @@ namespace AtomUI.Theme.Styling public static readonly TokenResourceKey ForegroundColor = new TokenResourceKey("CaptionButton.ForegroundColor", "AtomUI.Token"); } - public static class WindowResourceKey + public static class WindowTokenResourceKey { public static readonly TokenResourceKey DefaultBackground = new TokenResourceKey("Window.DefaultBackground", "AtomUI.Token"); public static readonly TokenResourceKey DefaultForeground = new TokenResourceKey("Window.DefaultForeground", "AtomUI.Token"); diff --git a/src/AtomUI.Controls/Input/SearchEdit.cs b/src/AtomUI.Controls/Input/SearchEdit.cs index 693b1cd..554072a 100644 --- a/src/AtomUI.Controls/Input/SearchEdit.cs +++ b/src/AtomUI.Controls/Input/SearchEdit.cs @@ -39,7 +39,7 @@ public class SearchEdit : LineEdit protected override void OnApplyTemplate(TemplateAppliedEventArgs e) { base.OnApplyTemplate(e); - TokenResourceBinder.CreateGlobalResourceBinding(this, BorderThicknessProperty, GlobalResourceKey.BorderThickness, + TokenResourceBinder.CreateGlobalResourceBinding(this, BorderThicknessProperty, GlobalTokenResourceKey.BorderThickness, BindingPriority.Template, new RenderScaleAwareThicknessConfigure(this)); } diff --git a/src/AtomUI.Controls/Input/TextBoxInnerBoxTheme.cs b/src/AtomUI.Controls/Input/TextBoxInnerBoxTheme.cs index 3113edb..71c02dd 100644 --- a/src/AtomUI.Controls/Input/TextBoxInnerBoxTheme.cs +++ b/src/AtomUI.Controls/Input/TextBoxInnerBoxTheme.cs @@ -14,7 +14,7 @@ internal class TextBoxInnerBoxTheme : AddOnDecoratedInnerBoxTheme var embedModeStyle = new Style(selector => selector.Nesting().PropertyEquals(TextBoxInnerBox.EmbedModeProperty, false)); var disabledStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Disabled)); var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(InnerBoxDecoratorPart)); - decoratorStyle.Add(Border.BackgroundProperty, GlobalResourceKey.ColorBgContainerDisabled); + decoratorStyle.Add(Border.BackgroundProperty, GlobalTokenResourceKey.ColorBgContainerDisabled); disabledStyle.Add(decoratorStyle); embedModeStyle.Add(disabledStyle); Add(embedModeStyle); diff --git a/src/AtomUI.Controls/Input/TextBoxTheme.cs b/src/AtomUI.Controls/Input/TextBoxTheme.cs index 0652ff1..84c1296 100644 --- a/src/AtomUI.Controls/Input/TextBoxTheme.cs +++ b/src/AtomUI.Controls/Input/TextBoxTheme.cs @@ -137,17 +137,17 @@ public class TextBoxTheme : BaseControlTheme var commonStyle = new Style(selector => selector.Nesting()); var largeStyle = new Style(selector => selector.Nesting().PropertyEquals(TextBox.SizeTypeProperty, SizeType.Large)); - largeStyle.Add(TextBox.LineHeightProperty, GlobalResourceKey.FontHeightLG); + largeStyle.Add(TextBox.LineHeightProperty, GlobalTokenResourceKey.FontHeightLG); commonStyle.Add(largeStyle); var middleStyle = new Style(selector => selector.Nesting().PropertyEquals(TextBox.SizeTypeProperty, SizeType.Middle)); - middleStyle.Add(TextBox.LineHeightProperty, GlobalResourceKey.FontHeight); + middleStyle.Add(TextBox.LineHeightProperty, GlobalTokenResourceKey.FontHeight); commonStyle.Add(middleStyle); var smallStyle = new Style(selector => selector.Nesting().PropertyEquals(TextBox.SizeTypeProperty, SizeType.Small)); - smallStyle.Add(TextBox.LineHeightProperty, GlobalResourceKey.FontHeightSM); + smallStyle.Add(TextBox.LineHeightProperty, GlobalTokenResourceKey.FontHeightSM); commonStyle.Add(smallStyle); Add(commonStyle); @@ -155,8 +155,8 @@ public class TextBoxTheme : BaseControlTheme private void BuildFixedStyle() { - this.Add(TextBox.SelectionBrushProperty, GlobalResourceKey.SelectionBackground); - this.Add(TextBox.SelectionForegroundBrushProperty, GlobalResourceKey.SelectionForeground); + this.Add(TextBox.SelectionBrushProperty, GlobalTokenResourceKey.SelectionBackground); + this.Add(TextBox.SelectionForegroundBrushProperty, GlobalTokenResourceKey.SelectionForeground); this.Add(TextBox.VerticalAlignmentProperty, VerticalAlignment.Center); this.Add(TextBox.VerticalContentAlignmentProperty, VerticalAlignment.Center); this.Add(ScrollViewer.IsScrollChainingEnabledProperty, true); @@ -171,7 +171,7 @@ public class TextBoxTheme : BaseControlTheme { var errorStyle = new Style(selector => selector.Nesting().Class(AddOnDecoratedBox.ErrorPC)); var scrollViewerStyle = new Style(selector => selector.Nesting().Template().Name(ScrollViewerPart)); - scrollViewerStyle.Add(ScrollViewer.ForegroundProperty, GlobalResourceKey.ColorErrorText); + scrollViewerStyle.Add(ScrollViewer.ForegroundProperty, GlobalTokenResourceKey.ColorErrorText); errorStyle.Add(scrollViewerStyle); borderlessStyle.Add(errorStyle); } @@ -179,7 +179,7 @@ public class TextBoxTheme : BaseControlTheme { var warningStyle = new Style(selector => selector.Nesting().Class(AddOnDecoratedBox.WarningPC)); var scrollViewerStyle = new Style(selector => selector.Nesting().Template().Name(ScrollViewerPart)); - scrollViewerStyle.Add(ScrollViewer.ForegroundProperty, GlobalResourceKey.ColorWarningText); + scrollViewerStyle.Add(ScrollViewer.ForegroundProperty, GlobalTokenResourceKey.ColorWarningText); warningStyle.Add(scrollViewerStyle); borderlessStyle.Add(warningStyle); } @@ -194,7 +194,7 @@ public class TextBoxTheme : BaseControlTheme var errorStyle = new Style(selector => selector.Nesting().Class(AddOnDecoratedBox.ErrorPC)); var scrollViewerStyle = new Style(selector => selector.Nesting().Template().Name(ScrollViewerPart)); - scrollViewerStyle.Add(ScrollViewer.ForegroundProperty, GlobalResourceKey.ColorErrorText); + scrollViewerStyle.Add(ScrollViewer.ForegroundProperty, GlobalTokenResourceKey.ColorErrorText); errorStyle.Add(scrollViewerStyle); filledStyle.Add(errorStyle); } @@ -202,7 +202,7 @@ public class TextBoxTheme : BaseControlTheme { var warningStyle = new Style(selector => selector.Nesting().Class(AddOnDecoratedBox.WarningPC)); var scrollViewerStyle = new Style(selector => selector.Nesting().Template().Name(ScrollViewerPart)); - scrollViewerStyle.Add(ScrollViewer.ForegroundProperty, GlobalResourceKey.ColorWarningText); + scrollViewerStyle.Add(ScrollViewer.ForegroundProperty, GlobalTokenResourceKey.ColorWarningText); warningStyle.Add(scrollViewerStyle); filledStyle.Add(warningStyle); } diff --git a/src/AtomUI.Controls/Loading/LoadingIndicatorTheme.cs b/src/AtomUI.Controls/Loading/LoadingIndicatorTheme.cs index c5e8a66..3b5238d 100644 --- a/src/AtomUI.Controls/Loading/LoadingIndicatorTheme.cs +++ b/src/AtomUI.Controls/Loading/LoadingIndicatorTheme.cs @@ -47,13 +47,13 @@ public class LoadingIndicatorTheme : BaseControlTheme var commonStyle = new Style(selector => selector.Nesting()); commonStyle.Add(LoadingIndicator.HorizontalAlignmentProperty, HorizontalAlignment.Left); commonStyle.Add(LoadingIndicator.VerticalAlignmentProperty, VerticalAlignment.Top); - commonStyle.Add(LoadingIndicator.FontSizeProperty, GlobalResourceKey.FontSize); + commonStyle.Add(LoadingIndicator.FontSizeProperty, GlobalTokenResourceKey.FontSize); commonStyle.Add(LoadingIndicator.MotionEasingCurveProperty, new LinearEasing()); - commonStyle.Add(LoadingIndicator.MotionDurationProperty, LoadingIndicatorResourceKey.IndicatorDuration); - commonStyle.Add(LoadingIndicator.DotBgBrushProperty, GlobalResourceKey.ColorPrimary); - commonStyle.Add(LoadingIndicator.IndicatorTextMarginProperty, GlobalResourceKey.MarginXXS); + commonStyle.Add(LoadingIndicator.MotionDurationProperty, LoadingIndicatorTokenResourceKey.IndicatorDuration); + commonStyle.Add(LoadingIndicator.DotBgBrushProperty, GlobalTokenResourceKey.ColorPrimary); + commonStyle.Add(LoadingIndicator.IndicatorTextMarginProperty, GlobalTokenResourceKey.MarginXXS); var loadingTextStyle = new Style(selector => selector.Nesting().Template().OfType()); - loadingTextStyle.Add(TextBlock.ForegroundProperty, GlobalResourceKey.ColorPrimary); + loadingTextStyle.Add(TextBlock.ForegroundProperty, GlobalTokenResourceKey.ColorPrimary); commonStyle.Add(loadingTextStyle); BuildDotSizeStyle(commonStyle); BuildCustomIconStyle(); @@ -93,15 +93,15 @@ public class LoadingIndicatorTheme : BaseControlTheme private void BuildDotSizeStyle(Style commonStyle) { var largeSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(LoadingIndicator.SizeTypeProperty, SizeType.Large)); - largeSizeStyle.Add(LoadingIndicator.DotSizeProperty, LoadingIndicatorResourceKey.DotSizeLG); + largeSizeStyle.Add(LoadingIndicator.DotSizeProperty, LoadingIndicatorTokenResourceKey.DotSizeLG); commonStyle.Add(largeSizeStyle); var middleSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(LoadingIndicator.SizeTypeProperty, SizeType.Middle)); - middleSizeStyle.Add(LoadingIndicator.DotSizeProperty, LoadingIndicatorResourceKey.DotSize); + middleSizeStyle.Add(LoadingIndicator.DotSizeProperty, LoadingIndicatorTokenResourceKey.DotSize); commonStyle.Add(middleSizeStyle); var smallSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(LoadingIndicator.SizeTypeProperty, SizeType.Small)); - smallSizeStyle.Add(LoadingIndicator.DotSizeProperty, LoadingIndicatorResourceKey.DotSizeSM); + smallSizeStyle.Add(LoadingIndicator.DotSizeProperty, LoadingIndicatorTokenResourceKey.DotSizeSM); commonStyle.Add(smallSizeStyle); } } \ No newline at end of file diff --git a/src/AtomUI.Controls/Loading/Localization/en_US.cs b/src/AtomUI.Controls/Loading/Localization/en_US.cs index 79f2ca6..8c701ad 100644 --- a/src/AtomUI.Controls/Loading/Localization/en_US.cs +++ b/src/AtomUI.Controls/Loading/Localization/en_US.cs @@ -6,5 +6,5 @@ namespace AtomUI.Controls.Lang; [LanguageProvider(LanguageCode.en_US, LoadingIndicatorToken.ID)] internal class en_US : AbstractLanguageProvider { - public string LoadingText { get; } = "Loading"; + public string LoadingText = "Loading"; } \ No newline at end of file diff --git a/src/AtomUI.Controls/Loading/Localization/zh_CN.cs b/src/AtomUI.Controls/Loading/Localization/zh_CN.cs index 8f2eab5..a371f36 100644 --- a/src/AtomUI.Controls/Loading/Localization/zh_CN.cs +++ b/src/AtomUI.Controls/Loading/Localization/zh_CN.cs @@ -6,5 +6,5 @@ namespace AtomUI.Controls.LoadingLang; [LanguageProvider(LanguageCode.zh_CN, LoadingIndicatorToken.ID)] internal class zh_CN : AbstractLanguageProvider { - public string LoadingText { get; } = "加载中"; + public string LoadingText = "加载中"; } \ No newline at end of file diff --git a/src/AtomUI.Controls/MarqueeLabel/MarqueeLabel.cs b/src/AtomUI.Controls/MarqueeLabel/MarqueeLabel.cs index e456aa3..15e7a4c 100644 --- a/src/AtomUI.Controls/MarqueeLabel/MarqueeLabel.cs +++ b/src/AtomUI.Controls/MarqueeLabel/MarqueeLabel.cs @@ -122,8 +122,8 @@ public class MarqueeLabel : TextBlock, void IControlCustomStyle.SetupTokenBindings() { - TokenResourceBinder.CreateTokenBinding(this, CycleSpaceProperty, MarqueeLabelResourceKey.CycleSpace); - TokenResourceBinder.CreateTokenBinding(this, MoveSpeedProperty, MarqueeLabelResourceKey.DefaultSpeed); + TokenResourceBinder.CreateTokenBinding(this, CycleSpaceProperty, MarqueeLabelTokenResourceKey.CycleSpace); + TokenResourceBinder.CreateTokenBinding(this, MoveSpeedProperty, MarqueeLabelTokenResourceKey.DefaultSpeed); } void IControlCustomStyle.HandlePropertyChangedForStyle(AvaloniaPropertyChangedEventArgs e) diff --git a/src/AtomUI.Controls/Menu/ContextMenuTheme.cs b/src/AtomUI.Controls/Menu/ContextMenuTheme.cs index ae9d06f..9b0eacd 100644 --- a/src/AtomUI.Controls/Menu/ContextMenuTheme.cs +++ b/src/AtomUI.Controls/Menu/ContextMenuTheme.cs @@ -26,13 +26,13 @@ public class ContextMenuTheme : BaseControlTheme { Name = RootContainerPart }; - TokenResourceBinder.CreateTokenBinding(wrapper, Border.BackgroundProperty, MenuResourceKey.MenuBgColor); - TokenResourceBinder.CreateTokenBinding(wrapper, Border.MinWidthProperty, MenuResourceKey.MenuPopupMinWidth); - TokenResourceBinder.CreateTokenBinding(wrapper, Border.MaxWidthProperty, MenuResourceKey.MenuPopupMaxWidth); - TokenResourceBinder.CreateTokenBinding(wrapper, Border.MinHeightProperty, MenuResourceKey.MenuPopupMinHeight); - TokenResourceBinder.CreateTokenBinding(wrapper, Border.MaxHeightProperty, MenuResourceKey.MenuPopupMaxHeight); - TokenResourceBinder.CreateTokenBinding(wrapper, Border.PaddingProperty, MenuResourceKey.MenuPopupContentPadding); - TokenResourceBinder.CreateTokenBinding(wrapper, Border.CornerRadiusProperty, MenuResourceKey.MenuPopupBorderRadius); + TokenResourceBinder.CreateTokenBinding(wrapper, Border.BackgroundProperty, MenuTokenResourceKey.MenuBgColor); + TokenResourceBinder.CreateTokenBinding(wrapper, Border.MinWidthProperty, MenuTokenResourceKey.MenuPopupMinWidth); + TokenResourceBinder.CreateTokenBinding(wrapper, Border.MaxWidthProperty, MenuTokenResourceKey.MenuPopupMaxWidth); + TokenResourceBinder.CreateTokenBinding(wrapper, Border.MinHeightProperty, MenuTokenResourceKey.MenuPopupMinHeight); + TokenResourceBinder.CreateTokenBinding(wrapper, Border.MaxHeightProperty, MenuTokenResourceKey.MenuPopupMaxHeight); + TokenResourceBinder.CreateTokenBinding(wrapper, Border.PaddingProperty, MenuTokenResourceKey.MenuPopupContentPadding); + TokenResourceBinder.CreateTokenBinding(wrapper, Border.CornerRadiusProperty, MenuTokenResourceKey.MenuPopupBorderRadius); var scrollViewer = new MenuScrollViewer(); var itemsPresenter = new ItemsPresenter @@ -51,6 +51,6 @@ public class ContextMenuTheme : BaseControlTheme protected override void BuildStyles() { this.Add(ContextMenu.BackgroundProperty, new SolidColorBrush(Colors.Transparent)); - this.Add(ContextMenu.CornerRadiusProperty, MenuResourceKey.MenuPopupBorderRadius); + this.Add(ContextMenu.CornerRadiusProperty, MenuTokenResourceKey.MenuPopupBorderRadius); } } \ No newline at end of file diff --git a/src/AtomUI.Controls/Menu/MenuItem.cs b/src/AtomUI.Controls/Menu/MenuItem.cs index 5b56d63..954a7e5 100644 --- a/src/AtomUI.Controls/Menu/MenuItem.cs +++ b/src/AtomUI.Controls/Menu/MenuItem.cs @@ -90,9 +90,9 @@ public class MenuItem : AvaloniaMenuItem, IControlCustomStyle UpdatePseudoClasses(); } else if (e.Property == IconProperty) { if (Icon is not null && Icon is PathIcon pathIcon) { - TokenResourceBinder.CreateTokenBinding(pathIcon, PathIcon.WidthProperty, MenuResourceKey.ItemIconSize); - TokenResourceBinder.CreateTokenBinding(pathIcon, PathIcon.HeightProperty, MenuResourceKey.ItemIconSize); - TokenResourceBinder.CreateTokenBinding(pathIcon, PathIcon.NormalFilledBrushProperty, MenuResourceKey.ItemColor); + TokenResourceBinder.CreateTokenBinding(pathIcon, PathIcon.WidthProperty, MenuTokenResourceKey.ItemIconSize); + TokenResourceBinder.CreateTokenBinding(pathIcon, PathIcon.HeightProperty, MenuTokenResourceKey.ItemIconSize); + TokenResourceBinder.CreateTokenBinding(pathIcon, PathIcon.NormalFilledBrushProperty, MenuTokenResourceKey.ItemColor); } } else if (e.Property == ToggleTypeProperty) { HandleToggleTypeChanged(); diff --git a/src/AtomUI.Controls/Menu/MenuItemTheme.cs b/src/AtomUI.Controls/Menu/MenuItemTheme.cs index 030ab22..9e4d586 100644 --- a/src/AtomUI.Controls/Menu/MenuItemTheme.cs +++ b/src/AtomUI.Controls/Menu/MenuItemTheme.cs @@ -95,9 +95,9 @@ internal class MenuItemTheme : BaseControlTheme Grid.SetColumn(iconPresenter, 1); iconPresenter.RegisterInNameScope(scope); CreateTemplateParentBinding(iconPresenter, Viewbox.ChildProperty, MenuItem.IconProperty); - TokenResourceBinder.CreateTokenBinding(iconPresenter, Viewbox.MarginProperty, MenuResourceKey.ItemMargin); - TokenResourceBinder.CreateGlobalTokenBinding(iconPresenter, Viewbox.WidthProperty, MenuResourceKey.ItemIconSize); - TokenResourceBinder.CreateGlobalTokenBinding(iconPresenter, Viewbox.HeightProperty, MenuResourceKey.ItemIconSize); + TokenResourceBinder.CreateTokenBinding(iconPresenter, Viewbox.MarginProperty, MenuTokenResourceKey.ItemMargin); + TokenResourceBinder.CreateGlobalTokenBinding(iconPresenter, Viewbox.WidthProperty, MenuTokenResourceKey.ItemIconSize); + TokenResourceBinder.CreateGlobalTokenBinding(iconPresenter, Viewbox.HeightProperty, MenuTokenResourceKey.ItemIconSize); var itemTextPresenter = new ContentPresenter { @@ -108,7 +108,7 @@ internal class MenuItemTheme : BaseControlTheme IsHitTestVisible = false }; Grid.SetColumn(itemTextPresenter, 2); - TokenResourceBinder.CreateTokenBinding(itemTextPresenter, ContentPresenter.MarginProperty, MenuResourceKey.ItemMargin); + TokenResourceBinder.CreateTokenBinding(itemTextPresenter, ContentPresenter.MarginProperty, MenuTokenResourceKey.ItemMargin); CreateTemplateParentBinding(itemTextPresenter, ContentPresenter.ContentProperty, MenuItem.HeaderProperty); CreateTemplateParentBinding(itemTextPresenter, ContentPresenter.ContentTemplateProperty, MenuItem.HeaderTemplateProperty); @@ -122,7 +122,7 @@ internal class MenuItemTheme : BaseControlTheme VerticalAlignment = VerticalAlignment.Center, }; Grid.SetColumn(inputGestureText, 3); - TokenResourceBinder.CreateTokenBinding(inputGestureText, ContentPresenter.MarginProperty, MenuResourceKey.ItemMargin); + TokenResourceBinder.CreateTokenBinding(inputGestureText, ContentPresenter.MarginProperty, MenuTokenResourceKey.ItemMargin); CreateTemplateParentBinding(inputGestureText, TextBlock.TextProperty, MenuItem.InputGestureProperty, @@ -138,8 +138,8 @@ internal class MenuItemTheme : BaseControlTheme VerticalAlignment = VerticalAlignment.Center, Kind = "RightOutlined" }; - TokenResourceBinder.CreateGlobalTokenBinding(menuIndicatorIcon, PathIcon.WidthProperty, GlobalResourceKey.IconSizeXS); - TokenResourceBinder.CreateGlobalTokenBinding(menuIndicatorIcon, PathIcon.HeightProperty, GlobalResourceKey.IconSizeXS); + TokenResourceBinder.CreateGlobalTokenBinding(menuIndicatorIcon, PathIcon.WidthProperty, GlobalTokenResourceKey.IconSizeXS); + TokenResourceBinder.CreateGlobalTokenBinding(menuIndicatorIcon, PathIcon.HeightProperty, GlobalTokenResourceKey.IconSizeXS); Grid.SetColumn(menuIndicatorIcon, 4); menuIndicatorIcon.RegisterInNameScope(scope); @@ -170,13 +170,13 @@ internal class MenuItemTheme : BaseControlTheme }; var border = new Border(); - TokenResourceBinder.CreateTokenBinding(border, Border.BackgroundProperty, GlobalResourceKey.ColorBgContainer); - TokenResourceBinder.CreateTokenBinding(border, Border.CornerRadiusProperty, MenuResourceKey.MenuPopupBorderRadius); - TokenResourceBinder.CreateTokenBinding(border, Border.MinWidthProperty, MenuResourceKey.MenuPopupMinWidth); - TokenResourceBinder.CreateTokenBinding(border, Border.MaxWidthProperty, MenuResourceKey.MenuPopupMaxWidth); - TokenResourceBinder.CreateTokenBinding(border, Border.MinHeightProperty, MenuResourceKey.MenuPopupMinHeight); - TokenResourceBinder.CreateTokenBinding(border, Border.MaxHeightProperty, MenuResourceKey.MenuPopupMaxHeight); - TokenResourceBinder.CreateTokenBinding(border, Border.PaddingProperty, MenuResourceKey.MenuPopupContentPadding); + TokenResourceBinder.CreateTokenBinding(border, Border.BackgroundProperty, GlobalTokenResourceKey.ColorBgContainer); + TokenResourceBinder.CreateTokenBinding(border, Border.CornerRadiusProperty, MenuTokenResourceKey.MenuPopupBorderRadius); + TokenResourceBinder.CreateTokenBinding(border, Border.MinWidthProperty, MenuTokenResourceKey.MenuPopupMinWidth); + TokenResourceBinder.CreateTokenBinding(border, Border.MaxWidthProperty, MenuTokenResourceKey.MenuPopupMaxWidth); + TokenResourceBinder.CreateTokenBinding(border, Border.MinHeightProperty, MenuTokenResourceKey.MenuPopupMinHeight); + TokenResourceBinder.CreateTokenBinding(border, Border.MaxHeightProperty, MenuTokenResourceKey.MenuPopupMaxHeight); + TokenResourceBinder.CreateTokenBinding(border, Border.PaddingProperty, MenuTokenResourceKey.MenuPopupContentPadding); var scrollViewer = new MenuScrollViewer(); var itemsPresenter = new ItemsPresenter @@ -190,8 +190,8 @@ internal class MenuItemTheme : BaseControlTheme popup.Child = border; - TokenResourceBinder.CreateTokenBinding(popup, Popup.MarginToAnchorProperty, MenuResourceKey.TopLevelItemPopupMarginToAnchor); - TokenResourceBinder.CreateTokenBinding(popup, Popup.MaskShadowsProperty, MenuResourceKey.MenuPopupBoxShadows); + TokenResourceBinder.CreateTokenBinding(popup, Popup.MarginToAnchorProperty, MenuTokenResourceKey.TopLevelItemPopupMarginToAnchor); + TokenResourceBinder.CreateTokenBinding(popup, Popup.MaskShadowsProperty, MenuTokenResourceKey.MenuPopupBoxShadows); CreateTemplateParentBinding(popup, Popup.IsOpenProperty, MenuItem.IsSubMenuOpenProperty, BindingMode.TwoWay); return popup; @@ -209,27 +209,27 @@ internal class MenuItemTheme : BaseControlTheme private void BuildCommonStyle(Style commonStyle) { - commonStyle.Add(MenuItem.ForegroundProperty, MenuResourceKey.ItemColor); + commonStyle.Add(MenuItem.ForegroundProperty, MenuTokenResourceKey.ItemColor); { var keyGestureStyle = new Style(selector => selector.Nesting().Template().Name(InputGestureTextPart)); - keyGestureStyle.Add(TextBlock.ForegroundProperty, MenuResourceKey.KeyGestureColor); + keyGestureStyle.Add(TextBlock.ForegroundProperty, MenuTokenResourceKey.KeyGestureColor); commonStyle.Add(keyGestureStyle); } { var borderStyle = new Style(selector => selector.Nesting().Template().Name(ItemDecoratorPart)); - borderStyle.Add(Border.MinHeightProperty, MenuResourceKey.ItemHeight); - borderStyle.Add(Border.PaddingProperty, MenuResourceKey.ItemPaddingInline); - borderStyle.Add(Border.BackgroundProperty, MenuResourceKey.ItemBg); - borderStyle.Add(Border.CornerRadiusProperty, MenuResourceKey.ItemBorderRadius); + borderStyle.Add(Border.MinHeightProperty, MenuTokenResourceKey.ItemHeight); + borderStyle.Add(Border.PaddingProperty, MenuTokenResourceKey.ItemPaddingInline); + borderStyle.Add(Border.BackgroundProperty, MenuTokenResourceKey.ItemBg); + borderStyle.Add(Border.CornerRadiusProperty, MenuTokenResourceKey.ItemBorderRadius); commonStyle.Add(borderStyle); } // Hover 状态 var hoverStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver)); - hoverStyle.Add(MenuItem.ForegroundProperty, MenuResourceKey.ItemHoverColor); + hoverStyle.Add(MenuItem.ForegroundProperty, MenuTokenResourceKey.ItemHoverColor); { var borderStyle = new Style(selector => selector.Nesting().Template().Name(ItemDecoratorPart)); - borderStyle.Add(Border.BackgroundProperty, MenuResourceKey.ItemHoverBg); + borderStyle.Add(Border.BackgroundProperty, MenuTokenResourceKey.ItemHoverBg); hoverStyle.Add(borderStyle); } commonStyle.Add(hoverStyle); @@ -271,7 +271,7 @@ internal class MenuItemTheme : BaseControlTheme private void BuildDisabledStyle() { var disabledStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Disabled)); - disabledStyle.Add(MenuItem.ForegroundProperty, MenuResourceKey.ItemDisabledColor); + disabledStyle.Add(MenuItem.ForegroundProperty, MenuTokenResourceKey.ItemDisabledColor); Add(disabledStyle); } } \ No newline at end of file diff --git a/src/AtomUI.Controls/Menu/MenuScrollViewerTheme.cs b/src/AtomUI.Controls/Menu/MenuScrollViewerTheme.cs index e779ac2..9ed0981 100644 --- a/src/AtomUI.Controls/Menu/MenuScrollViewerTheme.cs +++ b/src/AtomUI.Controls/Menu/MenuScrollViewerTheme.cs @@ -45,8 +45,8 @@ internal class MenuScrollViewerTheme : BaseControlTheme RenderTransform = null }; CreateTemplateParentBinding(scrollUpButton, IconButton.CommandProperty, nameof(MenuScrollViewer.LineUp)); - TokenResourceBinder.CreateTokenBinding(scrollUpButton.Icon, PathIcon.WidthProperty, MenuResourceKey.ScrollButtonIconSize); - TokenResourceBinder.CreateTokenBinding(scrollUpButton.Icon, PathIcon.HeightProperty, MenuResourceKey.ScrollButtonIconSize); + TokenResourceBinder.CreateTokenBinding(scrollUpButton.Icon, PathIcon.WidthProperty, MenuTokenResourceKey.ScrollButtonIconSize); + TokenResourceBinder.CreateTokenBinding(scrollUpButton.Icon, PathIcon.HeightProperty, MenuTokenResourceKey.ScrollButtonIconSize); DockPanel.SetDock(scrollUpButton, Dock.Top); var scrollDownButton = new IconButton() { @@ -61,8 +61,8 @@ internal class MenuScrollViewerTheme : BaseControlTheme RenderTransform = null }; CreateTemplateParentBinding(scrollDownButton, IconButton.CommandProperty, nameof(MenuScrollViewer.LineDown)); - TokenResourceBinder.CreateTokenBinding(scrollDownButton.Icon, PathIcon.WidthProperty, MenuResourceKey.ScrollButtonIconSize); - TokenResourceBinder.CreateTokenBinding(scrollDownButton.Icon, PathIcon.HeightProperty, MenuResourceKey.ScrollButtonIconSize); + TokenResourceBinder.CreateTokenBinding(scrollDownButton.Icon, PathIcon.WidthProperty, MenuTokenResourceKey.ScrollButtonIconSize); + TokenResourceBinder.CreateTokenBinding(scrollDownButton.Icon, PathIcon.HeightProperty, MenuTokenResourceKey.ScrollButtonIconSize); DockPanel.SetDock(scrollDownButton, Dock.Bottom); var scrollViewContent = CreateScrollContentPresenter(viewer); @@ -110,15 +110,15 @@ internal class MenuScrollViewerTheme : BaseControlTheme { { var iconButtonStyle = new Style(selector => selector.Nesting().Template().OfType()); - iconButtonStyle.Add(IconButton.PaddingProperty, MenuResourceKey.ScrollButtonPadding); - iconButtonStyle.Add(IconButton.MarginProperty, MenuResourceKey.ScrollButtonMargin); - iconButtonStyle.Add(IconButton.BackgroundProperty, GlobalResourceKey.ColorTransparent); + iconButtonStyle.Add(IconButton.PaddingProperty, MenuTokenResourceKey.ScrollButtonPadding); + iconButtonStyle.Add(IconButton.MarginProperty, MenuTokenResourceKey.ScrollButtonMargin); + iconButtonStyle.Add(IconButton.BackgroundProperty, GlobalTokenResourceKey.ColorTransparent); Add(iconButtonStyle); } { var iconButtonStyle = new Style(selector => selector.Nesting().Template().OfType().Class(StdPseudoClass.PointerOver)); - iconButtonStyle.Add(IconButton.BackgroundProperty, MenuResourceKey.ItemHoverBg); + iconButtonStyle.Add(IconButton.BackgroundProperty, MenuTokenResourceKey.ItemHoverBg); Add(iconButtonStyle); } diff --git a/src/AtomUI.Controls/Menu/MenuSeparator.cs b/src/AtomUI.Controls/Menu/MenuSeparator.cs index f20ccaf..d610cd0 100644 --- a/src/AtomUI.Controls/Menu/MenuSeparator.cs +++ b/src/AtomUI.Controls/Menu/MenuSeparator.cs @@ -26,7 +26,7 @@ public class MenuSeparator : AvaloniaSeparator { base.OnAttachedToVisualTree(e); if (!_initialized) { - TokenResourceBinder.CreateTokenBinding(this, LineWidthProperty, GlobalResourceKey.LineWidth, BindingPriority.Template, + TokenResourceBinder.CreateTokenBinding(this, LineWidthProperty, GlobalTokenResourceKey.LineWidth, BindingPriority.Template, new RenderScaleAwareDoubleConfigure(this)); _initialized = true; } diff --git a/src/AtomUI.Controls/Menu/MenuSeparatorTheme.cs b/src/AtomUI.Controls/Menu/MenuSeparatorTheme.cs index 6ae4ed6..0374a5b 100644 --- a/src/AtomUI.Controls/Menu/MenuSeparatorTheme.cs +++ b/src/AtomUI.Controls/Menu/MenuSeparatorTheme.cs @@ -15,8 +15,8 @@ public class MenuSeparatorTheme : BaseControlTheme protected override void BuildStyles() { var commonStyle = new Style(selector => selector.Nesting()); - commonStyle.Add(MenuSeparator.MinHeightProperty, MenuResourceKey.SeparatorItemHeight); - commonStyle.Add(MenuSeparator.BorderBrushProperty, GlobalResourceKey.ColorBorder); + commonStyle.Add(MenuSeparator.MinHeightProperty, MenuTokenResourceKey.SeparatorItemHeight); + commonStyle.Add(MenuSeparator.BorderBrushProperty, GlobalTokenResourceKey.ColorBorder); Add(commonStyle); } } \ No newline at end of file diff --git a/src/AtomUI.Controls/Menu/MenuTheme.cs b/src/AtomUI.Controls/Menu/MenuTheme.cs index 1b069b7..fb005c4 100644 --- a/src/AtomUI.Controls/Menu/MenuTheme.cs +++ b/src/AtomUI.Controls/Menu/MenuTheme.cs @@ -55,21 +55,21 @@ public class MenuTheme : BaseControlTheme { var commonStyle = new Style(selector => selector.Nesting()); commonStyle.Add(Menu.HorizontalAlignmentProperty, HorizontalAlignment.Left); - commonStyle.Add(Menu.BackgroundProperty, MenuResourceKey.MenuBgColor); - commonStyle.Add(Menu.BorderBrushProperty, GlobalResourceKey.ColorBorder); + commonStyle.Add(Menu.BackgroundProperty, MenuTokenResourceKey.MenuBgColor); + commonStyle.Add(Menu.BorderBrushProperty, GlobalTokenResourceKey.ColorBorder); var largeSizeType = new Style(selector => selector.Nesting().PropertyEquals(Menu.SizeTypeProperty, SizeType.Large)); - largeSizeType.Add(Menu.MinHeightProperty, GlobalResourceKey.ControlHeightLG); - largeSizeType.Add(Menu.CornerRadiusProperty, GlobalResourceKey.BorderRadius); + largeSizeType.Add(Menu.MinHeightProperty, GlobalTokenResourceKey.ControlHeightLG); + largeSizeType.Add(Menu.CornerRadiusProperty, GlobalTokenResourceKey.BorderRadius); commonStyle.Add(largeSizeType); var middleSizeType = new Style(selector => selector.Nesting().PropertyEquals(Menu.SizeTypeProperty, SizeType.Middle)); - middleSizeType.Add(Menu.MinHeightProperty, GlobalResourceKey.ControlHeight); - middleSizeType.Add(Menu.CornerRadiusProperty, GlobalResourceKey.BorderRadius); + middleSizeType.Add(Menu.MinHeightProperty, GlobalTokenResourceKey.ControlHeight); + middleSizeType.Add(Menu.CornerRadiusProperty, GlobalTokenResourceKey.BorderRadius); commonStyle.Add(middleSizeType); var smallSizeType = new Style(selector => selector.Nesting().PropertyEquals(Menu.SizeTypeProperty, SizeType.Small)); - smallSizeType.Add(Menu.MinHeightProperty, GlobalResourceKey.ControlHeightSM); - smallSizeType.Add(Menu.CornerRadiusProperty, GlobalResourceKey.BorderRadiusSM); + smallSizeType.Add(Menu.MinHeightProperty, GlobalTokenResourceKey.ControlHeightSM); + smallSizeType.Add(Menu.CornerRadiusProperty, GlobalTokenResourceKey.BorderRadiusSM); commonStyle.Add(smallSizeType); Add(commonStyle); } diff --git a/src/AtomUI.Controls/Menu/TopLevelMenuItemTheme.cs b/src/AtomUI.Controls/Menu/TopLevelMenuItemTheme.cs index 3c90abf..54a2ae7 100644 --- a/src/AtomUI.Controls/Menu/TopLevelMenuItemTheme.cs +++ b/src/AtomUI.Controls/Menu/TopLevelMenuItemTheme.cs @@ -70,13 +70,13 @@ public class TopLevelMenuItemTheme : BaseControlTheme var border = new Border(); - TokenResourceBinder.CreateTokenBinding(border, Border.BackgroundProperty, GlobalResourceKey.ColorBgContainer); - TokenResourceBinder.CreateTokenBinding(border, Border.CornerRadiusProperty, MenuResourceKey.MenuPopupBorderRadius); - TokenResourceBinder.CreateTokenBinding(border, Border.MinWidthProperty, MenuResourceKey.MenuPopupMinWidth); - TokenResourceBinder.CreateTokenBinding(border, Border.MaxWidthProperty, MenuResourceKey.MenuPopupMaxWidth); - TokenResourceBinder.CreateTokenBinding(border, Border.MinHeightProperty, MenuResourceKey.MenuPopupMinHeight); - TokenResourceBinder.CreateTokenBinding(border, Border.MaxHeightProperty, MenuResourceKey.MenuPopupMaxHeight); - TokenResourceBinder.CreateTokenBinding(border, Border.PaddingProperty, MenuResourceKey.MenuPopupContentPadding); + TokenResourceBinder.CreateTokenBinding(border, Border.BackgroundProperty, GlobalTokenResourceKey.ColorBgContainer); + TokenResourceBinder.CreateTokenBinding(border, Border.CornerRadiusProperty, MenuTokenResourceKey.MenuPopupBorderRadius); + TokenResourceBinder.CreateTokenBinding(border, Border.MinWidthProperty, MenuTokenResourceKey.MenuPopupMinWidth); + TokenResourceBinder.CreateTokenBinding(border, Border.MaxWidthProperty, MenuTokenResourceKey.MenuPopupMaxWidth); + TokenResourceBinder.CreateTokenBinding(border, Border.MinHeightProperty, MenuTokenResourceKey.MenuPopupMinHeight); + TokenResourceBinder.CreateTokenBinding(border, Border.MaxHeightProperty, MenuTokenResourceKey.MenuPopupMaxHeight); + TokenResourceBinder.CreateTokenBinding(border, Border.PaddingProperty, MenuTokenResourceKey.MenuPopupContentPadding); var scrollViewer = new MenuScrollViewer(); var itemsPresenter = new ItemsPresenter @@ -90,8 +90,8 @@ public class TopLevelMenuItemTheme : BaseControlTheme border.Child = scrollViewer; popup.Child = border; - TokenResourceBinder.CreateTokenBinding(popup, Popup.MarginToAnchorProperty, MenuResourceKey.TopLevelItemPopupMarginToAnchor); - TokenResourceBinder.CreateTokenBinding(popup, Popup.MaskShadowsProperty, MenuResourceKey.MenuPopupBoxShadows); + TokenResourceBinder.CreateTokenBinding(popup, Popup.MarginToAnchorProperty, MenuTokenResourceKey.TopLevelItemPopupMarginToAnchor); + TokenResourceBinder.CreateTokenBinding(popup, Popup.MaskShadowsProperty, MenuTokenResourceKey.MenuPopupBoxShadows); CreateTemplateParentBinding(popup, Popup.IsOpenProperty, MenuItem.IsSubMenuOpenProperty, BindingMode.TwoWay); @@ -110,12 +110,12 @@ public class TopLevelMenuItemTheme : BaseControlTheme private void BuildCommonStyle(Style topLevelStyle) { var commonStyle = new Style(selector => selector.Nesting().PropertyEquals(MenuItem.IsEnabledProperty, true)); - commonStyle.Add(MenuItem.BackgroundProperty, GlobalResourceKey.ColorTransparent); + commonStyle.Add(MenuItem.BackgroundProperty, GlobalTokenResourceKey.ColorTransparent); // 正常状态 { var contentPresenterStyle = new Style(selector => selector.Nesting().Template().OfType().Name(HeaderPresenterPart)); - contentPresenterStyle.Add(ContentPresenter.BackgroundProperty, GlobalResourceKey.ColorTransparent); + contentPresenterStyle.Add(ContentPresenter.BackgroundProperty, GlobalTokenResourceKey.ColorTransparent); commonStyle.Add(contentPresenterStyle); } @@ -123,8 +123,8 @@ public class TopLevelMenuItemTheme : BaseControlTheme var hoverStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver)); { var contentPresenterHoverStyle = new Style(selector => selector.Nesting().Template().OfType().Name(HeaderPresenterPart)); - contentPresenterHoverStyle.Add(ContentPresenter.BackgroundProperty, MenuResourceKey.TopLevelItemHoverBg); - contentPresenterHoverStyle.Add(ContentPresenter.ForegroundProperty, MenuResourceKey.TopLevelItemHoverColor); + contentPresenterHoverStyle.Add(ContentPresenter.BackgroundProperty, MenuTokenResourceKey.TopLevelItemHoverBg); + contentPresenterHoverStyle.Add(ContentPresenter.ForegroundProperty, MenuTokenResourceKey.TopLevelItemHoverColor); contentPresenterHoverStyle.Add(ContentPresenter.CursorProperty, new Cursor(StandardCursorType.Hand)); hoverStyle.Add(contentPresenterHoverStyle); } @@ -134,8 +134,8 @@ public class TopLevelMenuItemTheme : BaseControlTheme var openedStyle = new Style(selector => selector.Nesting().PropertyEquals(MenuItem.IsSubMenuOpenProperty, true)); { var contentPresenterHoverStyle = new Style(selector => selector.Nesting().Template().OfType().Name(HeaderPresenterPart)); - contentPresenterHoverStyle.Add(ContentPresenter.BackgroundProperty, MenuResourceKey.TopLevelItemHoverBg); - contentPresenterHoverStyle.Add(ContentPresenter.ForegroundProperty, MenuResourceKey.TopLevelItemHoverColor); + contentPresenterHoverStyle.Add(ContentPresenter.BackgroundProperty, MenuTokenResourceKey.TopLevelItemHoverBg); + contentPresenterHoverStyle.Add(ContentPresenter.ForegroundProperty, MenuTokenResourceKey.TopLevelItemHoverColor); contentPresenterHoverStyle.Add(ContentPresenter.CursorProperty, new Cursor(StandardCursorType.Hand)); openedStyle.Add(contentPresenterHoverStyle); } @@ -148,38 +148,38 @@ public class TopLevelMenuItemTheme : BaseControlTheme private void BuildSizeTypeStyle(Style topLevelStyle) { var largeSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(MenuItem.SizeTypeProperty, SizeType.Large)); - largeSizeStyle.Add(MenuItem.CornerRadiusProperty, MenuResourceKey.TopLevelItemBorderRadiusLG); - largeSizeStyle.Add(MenuItem.MinHeightProperty, GlobalResourceKey.ControlHeightLG); - largeSizeStyle.Add(MenuItem.PaddingProperty, MenuResourceKey.TopLevelItemPaddingLG); - largeSizeStyle.Add(MenuItem.FontSizeProperty, MenuResourceKey.TopLevelItemFontSizeLG); + largeSizeStyle.Add(MenuItem.CornerRadiusProperty, MenuTokenResourceKey.TopLevelItemBorderRadiusLG); + largeSizeStyle.Add(MenuItem.MinHeightProperty, GlobalTokenResourceKey.ControlHeightLG); + largeSizeStyle.Add(MenuItem.PaddingProperty, MenuTokenResourceKey.TopLevelItemPaddingLG); + largeSizeStyle.Add(MenuItem.FontSizeProperty, MenuTokenResourceKey.TopLevelItemFontSizeLG); { var presenterStyle = new Style(selector => selector.Nesting().Template().Name(HeaderPresenterPart)); - presenterStyle.Add(ContentPresenter.LineHeightProperty, MenuResourceKey.TopLevelItemLineHeightLG); + presenterStyle.Add(ContentPresenter.LineHeightProperty, MenuTokenResourceKey.TopLevelItemLineHeightLG); largeSizeStyle.Add(presenterStyle); } topLevelStyle.Add(largeSizeStyle); var middleSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(MenuItem.SizeTypeProperty, SizeType.Middle)); - middleSizeStyle.Add(MenuItem.CornerRadiusProperty, MenuResourceKey.TopLevelItemBorderRadius); - middleSizeStyle.Add(MenuItem.MinHeightProperty, GlobalResourceKey.ControlHeight); - middleSizeStyle.Add(MenuItem.PaddingProperty, MenuResourceKey.TopLevelItemPadding); - middleSizeStyle.Add(MenuItem.FontSizeProperty, MenuResourceKey.TopLevelItemFontSize); + middleSizeStyle.Add(MenuItem.CornerRadiusProperty, MenuTokenResourceKey.TopLevelItemBorderRadius); + middleSizeStyle.Add(MenuItem.MinHeightProperty, GlobalTokenResourceKey.ControlHeight); + middleSizeStyle.Add(MenuItem.PaddingProperty, MenuTokenResourceKey.TopLevelItemPadding); + middleSizeStyle.Add(MenuItem.FontSizeProperty, MenuTokenResourceKey.TopLevelItemFontSize); { var presenterStyle = new Style(selector => selector.Nesting().Template().Name(HeaderPresenterPart)); - presenterStyle.Add(ContentPresenter.LineHeightProperty, MenuResourceKey.TopLevelItemLineHeight); + presenterStyle.Add(ContentPresenter.LineHeightProperty, MenuTokenResourceKey.TopLevelItemLineHeight); middleSizeStyle.Add(presenterStyle); } topLevelStyle.Add(middleSizeStyle); var smallSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(MenuItem.SizeTypeProperty, SizeType.Small)); - smallSizeStyle.Add(MenuItem.CornerRadiusProperty, MenuResourceKey.TopLevelItemBorderRadiusSM); - smallSizeStyle.Add(MenuItem.MinHeightProperty, GlobalResourceKey.ControlHeightSM); - smallSizeStyle.Add(MenuItem.PaddingProperty, MenuResourceKey.TopLevelItemPaddingSM); - smallSizeStyle.Add(MenuItem.FontSizeProperty, MenuResourceKey.TopLevelItemFontSizeSM); + smallSizeStyle.Add(MenuItem.CornerRadiusProperty, MenuTokenResourceKey.TopLevelItemBorderRadiusSM); + smallSizeStyle.Add(MenuItem.MinHeightProperty, GlobalTokenResourceKey.ControlHeightSM); + smallSizeStyle.Add(MenuItem.PaddingProperty, MenuTokenResourceKey.TopLevelItemPaddingSM); + smallSizeStyle.Add(MenuItem.FontSizeProperty, MenuTokenResourceKey.TopLevelItemFontSizeSM); { var presenterStyle = new Style(selector => selector.Nesting().Template().Name(HeaderPresenterPart)); - presenterStyle.Add(ContentPresenter.LineHeightProperty, MenuResourceKey.TopLevelItemLineHeightSM); + presenterStyle.Add(ContentPresenter.LineHeightProperty, MenuTokenResourceKey.TopLevelItemLineHeightSM); smallSizeStyle.Add(presenterStyle); } topLevelStyle.Add(smallSizeStyle); @@ -188,7 +188,7 @@ public class TopLevelMenuItemTheme : BaseControlTheme private void BuildDisabledStyle(Style topLevelStyle) { var disabledStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Disabled)); - disabledStyle.Add(MenuItem.ForegroundProperty, MenuResourceKey.ItemDisabledColor); + disabledStyle.Add(MenuItem.ForegroundProperty, MenuTokenResourceKey.ItemDisabledColor); topLevelStyle.Add(disabledStyle); } } \ No newline at end of file diff --git a/src/AtomUI.Controls/OptionButtonBox/OptionButtonGroupTheme.cs b/src/AtomUI.Controls/OptionButtonBox/OptionButtonGroupTheme.cs index 20f25ef..eeefb0f 100644 --- a/src/AtomUI.Controls/OptionButtonBox/OptionButtonGroupTheme.cs +++ b/src/AtomUI.Controls/OptionButtonBox/OptionButtonGroupTheme.cs @@ -36,24 +36,24 @@ public class OptionButtonGroupTheme : BaseControlTheme { var largeSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(OptionButtonGroup.SizeTypeProperty, SizeType.Large)); - largeSizeStyle.Add(OptionButtonGroup.CornerRadiusProperty, GlobalResourceKey.BorderRadiusLG); - largeSizeStyle.Add(OptionButtonGroup.MaxHeightProperty, GlobalResourceKey.ControlHeightLG); + largeSizeStyle.Add(OptionButtonGroup.CornerRadiusProperty, GlobalTokenResourceKey.BorderRadiusLG); + largeSizeStyle.Add(OptionButtonGroup.MaxHeightProperty, GlobalTokenResourceKey.ControlHeightLG); Add(largeSizeStyle); var middleSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(OptionButtonGroup.SizeTypeProperty, SizeType.Middle)); - middleSizeStyle.Add(OptionButtonGroup.CornerRadiusProperty, GlobalResourceKey.BorderRadius); - middleSizeStyle.Add(OptionButtonGroup.MaxHeightProperty, GlobalResourceKey.ControlHeight); + middleSizeStyle.Add(OptionButtonGroup.CornerRadiusProperty, GlobalTokenResourceKey.BorderRadius); + middleSizeStyle.Add(OptionButtonGroup.MaxHeightProperty, GlobalTokenResourceKey.ControlHeight); Add(middleSizeStyle); var smallSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(OptionButtonGroup.SizeTypeProperty, SizeType.Small)); - smallSizeStyle.Add(OptionButtonGroup.CornerRadiusProperty, GlobalResourceKey.BorderRadiusSM); - smallSizeStyle.Add(OptionButtonGroup.MaxHeightProperty, GlobalResourceKey.ControlHeightSM); + smallSizeStyle.Add(OptionButtonGroup.CornerRadiusProperty, GlobalTokenResourceKey.BorderRadiusSM); + smallSizeStyle.Add(OptionButtonGroup.MaxHeightProperty, GlobalTokenResourceKey.ControlHeightSM); Add(smallSizeStyle); - this.Add(OptionButtonGroup.BorderBrushProperty, GlobalResourceKey.ColorBorder); - this.Add(OptionButtonGroup.SelectedOptionBorderColorProperty, GlobalResourceKey.ColorPrimary); - this.Add(OptionButtonGroup.BorderThicknessProperty, GlobalResourceKey.BorderThickness); + this.Add(OptionButtonGroup.BorderBrushProperty, GlobalTokenResourceKey.ColorBorder); + this.Add(OptionButtonGroup.SelectedOptionBorderColorProperty, GlobalTokenResourceKey.ColorPrimary); + this.Add(OptionButtonGroup.BorderThicknessProperty, GlobalTokenResourceKey.BorderThickness); } } \ No newline at end of file diff --git a/src/AtomUI.Controls/OptionButtonBox/OptionButtonTheme.cs b/src/AtomUI.Controls/OptionButtonBox/OptionButtonTheme.cs index 182a218..02735d6 100644 --- a/src/AtomUI.Controls/OptionButtonBox/OptionButtonTheme.cs +++ b/src/AtomUI.Controls/OptionButtonBox/OptionButtonTheme.cs @@ -44,26 +44,26 @@ public class OptionButtonTheme : BaseControlTheme { var largeSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(OptionButton.SizeTypeProperty, SizeType.Large)); - largeSizeStyle.Add(OptionButton.MinHeightProperty, GlobalResourceKey.ControlHeightLG); - largeSizeStyle.Add(OptionButton.FontSizeProperty, OptionButtonResourceKey.ContentFontSizeLG); - largeSizeStyle.Add(OptionButton.PaddingProperty, OptionButtonResourceKey.PaddingLG); - largeSizeStyle.Add(OptionButton.CornerRadiusProperty, GlobalResourceKey.BorderRadiusLG); + largeSizeStyle.Add(OptionButton.MinHeightProperty, GlobalTokenResourceKey.ControlHeightLG); + largeSizeStyle.Add(OptionButton.FontSizeProperty, OptionButtonTokenResourceKey.ContentFontSizeLG); + largeSizeStyle.Add(OptionButton.PaddingProperty, OptionButtonTokenResourceKey.PaddingLG); + largeSizeStyle.Add(OptionButton.CornerRadiusProperty, GlobalTokenResourceKey.BorderRadiusLG); Add(largeSizeStyle); var middleSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(OptionButton.SizeTypeProperty, SizeType.Middle)); - middleSizeStyle.Add(OptionButton.MinHeightProperty, GlobalResourceKey.ControlHeight); - middleSizeStyle.Add(OptionButton.FontSizeProperty, OptionButtonResourceKey.ContentFontSize); - middleSizeStyle.Add(OptionButton.PaddingProperty, OptionButtonResourceKey.Padding); - middleSizeStyle.Add(OptionButton.CornerRadiusProperty, GlobalResourceKey.BorderRadius); + middleSizeStyle.Add(OptionButton.MinHeightProperty, GlobalTokenResourceKey.ControlHeight); + middleSizeStyle.Add(OptionButton.FontSizeProperty, OptionButtonTokenResourceKey.ContentFontSize); + middleSizeStyle.Add(OptionButton.PaddingProperty, OptionButtonTokenResourceKey.Padding); + middleSizeStyle.Add(OptionButton.CornerRadiusProperty, GlobalTokenResourceKey.BorderRadius); Add(middleSizeStyle); var smallSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(OptionButton.SizeTypeProperty, SizeType.Small)); - smallSizeStyle.Add(OptionButton.MinHeightProperty, GlobalResourceKey.ControlHeightSM); - smallSizeStyle.Add(OptionButton.FontSizeProperty, OptionButtonResourceKey.ContentFontSizeSM); - smallSizeStyle.Add(OptionButton.PaddingProperty, OptionButtonResourceKey.PaddingSM); - smallSizeStyle.Add(OptionButton.CornerRadiusProperty, GlobalResourceKey.BorderRadiusSM); + smallSizeStyle.Add(OptionButton.MinHeightProperty, GlobalTokenResourceKey.ControlHeightSM); + smallSizeStyle.Add(OptionButton.FontSizeProperty, OptionButtonTokenResourceKey.ContentFontSizeSM); + smallSizeStyle.Add(OptionButton.PaddingProperty, OptionButtonTokenResourceKey.PaddingSM); + smallSizeStyle.Add(OptionButton.CornerRadiusProperty, GlobalTokenResourceKey.BorderRadiusSM); Add(smallSizeStyle); @@ -82,7 +82,7 @@ public class OptionButtonTheme : BaseControlTheme private void BuildOutlineStyle() { var outlineStyle = new Style(selector => selector.Nesting().PropertyEquals(OptionButton.ButtonStyleProperty, OptionButtonStyle.Outline)); - outlineStyle.Add(OptionButton.BorderThicknessProperty, GlobalResourceKey.BorderThickness); + outlineStyle.Add(OptionButton.BorderThicknessProperty, GlobalTokenResourceKey.BorderThickness); var inOptionGroupStyle = new Style(selector => selector.Nesting().PropertyEquals(OptionButton.InOptionGroupProperty, true)); inOptionGroupStyle.Add(OptionButton.BorderThicknessProperty, new Thickness(0)); outlineStyle.Add(inOptionGroupStyle); @@ -97,17 +97,17 @@ public class OptionButtonTheme : BaseControlTheme // 选中状态 { var checkedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Checked)); - checkedStyle.Add(OptionButton.ForegroundProperty, OptionButtonResourceKey.ButtonSolidCheckedColor); - checkedStyle.Add(OptionButton.BackgroundProperty, OptionButtonResourceKey.ButtonSolidCheckedBackground); + checkedStyle.Add(OptionButton.ForegroundProperty, OptionButtonTokenResourceKey.ButtonSolidCheckedColor); + checkedStyle.Add(OptionButton.BackgroundProperty, OptionButtonTokenResourceKey.ButtonSolidCheckedBackground); // Hover 状态 var hoverStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver)); - hoverStyle.Add(OptionButton.BackgroundProperty, OptionButtonResourceKey.ButtonSolidCheckedHoverBackground); + hoverStyle.Add(OptionButton.BackgroundProperty, OptionButtonTokenResourceKey.ButtonSolidCheckedHoverBackground); checkedStyle.Add(hoverStyle); // Pressed 状态 var pressedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Pressed)); - pressedStyle.Add(OptionButton.BackgroundProperty, OptionButtonResourceKey.ButtonSolidCheckedActiveBackground); + pressedStyle.Add(OptionButton.BackgroundProperty, OptionButtonTokenResourceKey.ButtonSolidCheckedActiveBackground); checkedStyle.Add(pressedStyle); enabledStyle.Add(checkedStyle); @@ -116,21 +116,21 @@ public class OptionButtonTheme : BaseControlTheme // 没选中状态 { var unCheckedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.UnChecked)); - unCheckedStyle.Add(OptionButton.ForegroundProperty, GlobalResourceKey.ColorText); - unCheckedStyle.Add(OptionButton.BackgroundProperty, GlobalResourceKey.ColorBgContainer); + unCheckedStyle.Add(OptionButton.ForegroundProperty, GlobalTokenResourceKey.ColorText); + unCheckedStyle.Add(OptionButton.BackgroundProperty, GlobalTokenResourceKey.ColorBgContainer); var inOptionGroupStyle = new Style(selector => selector.Nesting().PropertyEquals(OptionButton.InOptionGroupProperty, true)); - inOptionGroupStyle.Add(OptionButton.BackgroundProperty, GlobalResourceKey.ColorTransparent); + inOptionGroupStyle.Add(OptionButton.BackgroundProperty, GlobalTokenResourceKey.ColorTransparent); unCheckedStyle.Add(inOptionGroupStyle); // Hover 状态 var hoverStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver)); - hoverStyle.Add(OptionButton.ForegroundProperty, GlobalResourceKey.ColorPrimaryHover); + hoverStyle.Add(OptionButton.ForegroundProperty, GlobalTokenResourceKey.ColorPrimaryHover); unCheckedStyle.Add(hoverStyle); // Pressed 状态 var pressedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Pressed)); - pressedStyle.Add(OptionButton.ForegroundProperty, GlobalResourceKey.ColorPrimaryActive); + pressedStyle.Add(OptionButton.ForegroundProperty, GlobalTokenResourceKey.ColorPrimaryActive); unCheckedStyle.Add(pressedStyle); enabledStyle.Add(unCheckedStyle); @@ -143,13 +143,13 @@ public class OptionButtonTheme : BaseControlTheme { var disabledStyle = new Style(selector => selector.Nesting().PropertyEquals(OptionButton.IsEnabledProperty, false)); - disabledStyle.Add(OptionButton.BorderBrushProperty, GlobalResourceKey.ColorBorder); - disabledStyle.Add(OptionButton.ForegroundProperty, GlobalResourceKey.ColorTextDisabled); - disabledStyle.Add(OptionButton.BackgroundProperty, GlobalResourceKey.ColorBgContainerDisabled); + disabledStyle.Add(OptionButton.BorderBrushProperty, GlobalTokenResourceKey.ColorBorder); + disabledStyle.Add(OptionButton.ForegroundProperty, GlobalTokenResourceKey.ColorTextDisabled); + disabledStyle.Add(OptionButton.BackgroundProperty, GlobalTokenResourceKey.ColorBgContainerDisabled); var checkedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Checked)); - checkedStyle.Add(OptionButton.ForegroundProperty, OptionButtonResourceKey.ButtonCheckedColorDisabled); - checkedStyle.Add(OptionButton.BackgroundProperty, OptionButtonResourceKey.ButtonCheckedColorDisabled); + checkedStyle.Add(OptionButton.ForegroundProperty, OptionButtonTokenResourceKey.ButtonCheckedColorDisabled); + checkedStyle.Add(OptionButton.BackgroundProperty, OptionButtonTokenResourceKey.ButtonCheckedColorDisabled); disabledStyle.Add(checkedStyle); solidStyle.Add(disabledStyle); @@ -162,11 +162,11 @@ public class OptionButtonTheme : BaseControlTheme // 选中状态 { var checkedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Checked)); - checkedStyle.Add(OptionButton.BorderBrushProperty, GlobalResourceKey.ColorPrimary); - checkedStyle.Add(OptionButton.ForegroundProperty, GlobalResourceKey.ColorPrimary); - checkedStyle.Add(OptionButton.BackgroundProperty, OptionButtonResourceKey.ButtonBackground); + checkedStyle.Add(OptionButton.BorderBrushProperty, GlobalTokenResourceKey.ColorPrimary); + checkedStyle.Add(OptionButton.ForegroundProperty, GlobalTokenResourceKey.ColorPrimary); + checkedStyle.Add(OptionButton.BackgroundProperty, OptionButtonTokenResourceKey.ButtonBackground); var inOptionGroupStyle = new Style(selector => selector.Nesting().PropertyEquals(OptionButton.InOptionGroupProperty, true)); - inOptionGroupStyle.Add(OptionButton.BackgroundProperty, GlobalResourceKey.ColorTransparent); + inOptionGroupStyle.Add(OptionButton.BackgroundProperty, GlobalTokenResourceKey.ColorTransparent); checkedStyle.Add(inOptionGroupStyle); @@ -175,25 +175,25 @@ public class OptionButtonTheme : BaseControlTheme } // 没选中状态 { - enabledStyle.Add(OptionButton.BorderBrushProperty, GlobalResourceKey.ColorBorder); - enabledStyle.Add(OptionButton.ForegroundProperty, OptionButtonResourceKey.ButtonColor); - enabledStyle.Add(OptionButton.BackgroundProperty, OptionButtonResourceKey.ButtonCheckedBackground); + enabledStyle.Add(OptionButton.BorderBrushProperty, GlobalTokenResourceKey.ColorBorder); + enabledStyle.Add(OptionButton.ForegroundProperty, OptionButtonTokenResourceKey.ButtonColor); + enabledStyle.Add(OptionButton.BackgroundProperty, OptionButtonTokenResourceKey.ButtonCheckedBackground); var inOptionGroupStyle = new Style(selector => selector.Nesting().PropertyEquals(OptionButton.InOptionGroupProperty, true)); - inOptionGroupStyle.Add(OptionButton.BackgroundProperty, GlobalResourceKey.ColorTransparent); + inOptionGroupStyle.Add(OptionButton.BackgroundProperty, GlobalTokenResourceKey.ColorTransparent); enabledStyle.Add(inOptionGroupStyle); } // Hover 状态 var hoverStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver)); - hoverStyle.Add(OptionButton.BorderBrushProperty, GlobalResourceKey.ColorPrimaryHover); - hoverStyle.Add(OptionButton.ForegroundProperty, GlobalResourceKey.ColorPrimaryHover); + hoverStyle.Add(OptionButton.BorderBrushProperty, GlobalTokenResourceKey.ColorPrimaryHover); + hoverStyle.Add(OptionButton.ForegroundProperty, GlobalTokenResourceKey.ColorPrimaryHover); enabledStyle.Add(hoverStyle); // Pressed 状态 var pressedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Pressed)); - pressedStyle.Add(OptionButton.BorderBrushProperty, GlobalResourceKey.ColorPrimaryActive); - pressedStyle.Add(OptionButton.ForegroundProperty, GlobalResourceKey.ColorPrimaryActive); + pressedStyle.Add(OptionButton.BorderBrushProperty, GlobalTokenResourceKey.ColorPrimaryActive); + pressedStyle.Add(OptionButton.ForegroundProperty, GlobalTokenResourceKey.ColorPrimaryActive); enabledStyle.Add(pressedStyle); } @@ -201,13 +201,13 @@ public class OptionButtonTheme : BaseControlTheme { var disabledStyle = new Style(selector => selector.Nesting().PropertyEquals(OptionButton.IsEnabledProperty, false)); - disabledStyle.Add(OptionButton.BorderBrushProperty, GlobalResourceKey.ColorBorder); - disabledStyle.Add(OptionButton.ForegroundProperty, GlobalResourceKey.ColorTextDisabled); - disabledStyle.Add(OptionButton.BackgroundProperty, GlobalResourceKey.ColorBgContainerDisabled); + disabledStyle.Add(OptionButton.BorderBrushProperty, GlobalTokenResourceKey.ColorBorder); + disabledStyle.Add(OptionButton.ForegroundProperty, GlobalTokenResourceKey.ColorTextDisabled); + disabledStyle.Add(OptionButton.BackgroundProperty, GlobalTokenResourceKey.ColorBgContainerDisabled); var checkedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Checked)); - checkedStyle.Add(OptionButton.ForegroundProperty, OptionButtonResourceKey.ButtonCheckedColorDisabled); - checkedStyle.Add(OptionButton.BackgroundProperty, OptionButtonResourceKey.ButtonCheckedBgDisabled); + checkedStyle.Add(OptionButton.ForegroundProperty, OptionButtonTokenResourceKey.ButtonCheckedColorDisabled); + checkedStyle.Add(OptionButton.BackgroundProperty, OptionButtonTokenResourceKey.ButtonCheckedBgDisabled); disabledStyle.Add(checkedStyle); outlineStyle.Add(disabledStyle); diff --git a/src/AtomUI.Controls/Popup/Popup.cs b/src/AtomUI.Controls/Popup/Popup.cs index 438eefa..dae5959 100644 --- a/src/AtomUI.Controls/Popup/Popup.cs +++ b/src/AtomUI.Controls/Popup/Popup.cs @@ -89,8 +89,8 @@ public class Popup : AvaloniaPopup { base.OnAttachedToLogicalTree(e); if (!_initialized) { - TokenResourceBinder.CreateGlobalTokenBinding(this, MaskShadowsProperty, GlobalResourceKey.BoxShadowsSecondary); - TokenResourceBinder.CreateGlobalTokenBinding(this, MotionDurationProperty, GlobalResourceKey.MotionDurationMid); + TokenResourceBinder.CreateGlobalTokenBinding(this, MaskShadowsProperty, GlobalTokenResourceKey.BoxShadowsSecondary); + TokenResourceBinder.CreateGlobalTokenBinding(this, MotionDurationProperty, GlobalTokenResourceKey.MotionDurationMid); _initialized = true; } } diff --git a/src/AtomUI.Controls/ProgressBar/AbstractCircleProgressTheme.cs b/src/AtomUI.Controls/ProgressBar/AbstractCircleProgressTheme.cs index ef256fc..a334c41 100644 --- a/src/AtomUI.Controls/ProgressBar/AbstractCircleProgressTheme.cs +++ b/src/AtomUI.Controls/ProgressBar/AbstractCircleProgressTheme.cs @@ -27,8 +27,8 @@ internal class AbstractCircleProgressTheme : AbstractProgressBarTheme VerticalAlignment = VerticalAlignment.Center }; exceptionCompletedIcon.RegisterInNameScope(scope); - TokenResourceBinder.CreateGlobalTokenBinding(exceptionCompletedIcon, PathIcon.NormalFilledBrushProperty, GlobalResourceKey.ColorError); - TokenResourceBinder.CreateGlobalTokenBinding(exceptionCompletedIcon, PathIcon.DisabledFilledBrushProperty, GlobalResourceKey.ControlItemBgActiveDisabled); + TokenResourceBinder.CreateGlobalTokenBinding(exceptionCompletedIcon, PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorError); + TokenResourceBinder.CreateGlobalTokenBinding(exceptionCompletedIcon, PathIcon.DisabledFilledBrushProperty, GlobalTokenResourceKey.ControlItemBgActiveDisabled); var successCompletedIcon = new PathIcon { @@ -38,8 +38,8 @@ internal class AbstractCircleProgressTheme : AbstractProgressBarTheme VerticalAlignment = VerticalAlignment.Center, }; successCompletedIcon.RegisterInNameScope(scope); - TokenResourceBinder.CreateGlobalTokenBinding(successCompletedIcon, PathIcon.NormalFilledBrushProperty, GlobalResourceKey.ColorSuccess); - TokenResourceBinder.CreateGlobalTokenBinding(successCompletedIcon, PathIcon.DisabledFilledBrushProperty, GlobalResourceKey.ControlItemBgActiveDisabled); + TokenResourceBinder.CreateGlobalTokenBinding(successCompletedIcon, PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorSuccess); + TokenResourceBinder.CreateGlobalTokenBinding(successCompletedIcon, PathIcon.DisabledFilledBrushProperty, GlobalTokenResourceKey.ControlItemBgActiveDisabled); container.Children.Add(exceptionCompletedIcon); container.Children.Add(successCompletedIcon); @@ -50,8 +50,8 @@ internal class AbstractCircleProgressTheme : AbstractProgressBarTheme base.BuildStyles(); var commonStyle = new Style(selector => selector.Nesting()); - commonStyle.Add(AbstractCircleProgress.CircleMinimumTextFontSizeProperty, ProgressBarResourceKey.CircleMinimumTextFontSize); - commonStyle.Add(AbstractCircleProgress.CircleMinimumIconSizeProperty, ProgressBarResourceKey.CircleMinimumIconSize); + commonStyle.Add(AbstractCircleProgress.CircleMinimumTextFontSizeProperty, ProgressBarTokenResourceKey.CircleMinimumTextFontSize); + commonStyle.Add(AbstractCircleProgress.CircleMinimumIconSizeProperty, ProgressBarTokenResourceKey.CircleMinimumIconSize); { var labelStyle = new Style(selector => selector.Nesting().Template().OfType