mirror of
https://gitee.com/chinware/atomui.git
synced 2024-12-02 03:47:52 +08:00
重构 Token 资源生成类名
重构 Token 资源生成类名,加上 Token 后缀
This commit is contained in:
parent
c109350ffa
commit
b92f3e8c28
@ -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<Control>(AddOnDecoratedBoxTheme.LeftAddOnPart);
|
||||
|
@ -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<ContentPresenter>());
|
||||
addOnStyle.Add(ContentPresenter.ForegroundProperty, GlobalResourceKey.ColorTextDisabled);
|
||||
addOnStyle.Add(ContentPresenter.ForegroundProperty, GlobalTokenResourceKey.ColorTextDisabled);
|
||||
disabledStyle.Add(addOnStyle);
|
||||
Add(disabledStyle);
|
||||
}
|
||||
|
@ -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<StackPanel>(AddOnDecoratedInnerBoxTheme.LeftAddOnLayoutPart);
|
||||
_rightAddOnLayout = e.NameScope.Find<StackPanel>(AddOnDecoratedInnerBoxTheme.RightAddOnLayoutPart);
|
||||
_clearButton = e.NameScope.Find<IconButton>(AddOnDecoratedInnerBoxTheme.ClearButtonPart);
|
||||
|
@ -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<PathIcon>());
|
||||
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<PathIcon>());
|
||||
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<PathIcon>());
|
||||
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<PathIcon>());
|
||||
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<PathIcon>());
|
||||
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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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()
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
|
@ -175,31 +175,31 @@ internal partial class DotBadgeAdorner : Control, IControlCustomStyle
|
||||
private void BuildBadgeColorStyle()
|
||||
{
|
||||
var commonStyle = new Style(selector => selector.OfType<DotBadgeAdorner>());
|
||||
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);
|
||||
|
@ -135,15 +135,15 @@ internal class RibbonBadgeAdorner : Control, IControlCustomStyle
|
||||
void IControlCustomStyle.BuildStyles()
|
||||
{
|
||||
var commonStyle = new Style(selector => selector.OfType<RibbonBadgeAdorner>());
|
||||
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<TextBlock>());
|
||||
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);
|
||||
}
|
||||
|
@ -115,10 +115,10 @@ internal class ButtonSpinnerInnerBox : AddOnDecoratedInnerBox, ICustomHitTest
|
||||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||
{
|
||||
_handleContentPresenter = e.NameScope.Find<ContentPresenter>(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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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<PathIcon>());
|
||||
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<PathIcon>());
|
||||
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<PathIcon>());
|
||||
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<PathIcon>());
|
||||
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<PathIcon>());
|
||||
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<PathIcon>());
|
||||
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<PathIcon>());
|
||||
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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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<PathIcon>());
|
||||
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<PathIcon>());
|
||||
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<PathIcon>());
|
||||
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);
|
||||
}
|
||||
}
|
@ -31,10 +31,10 @@ internal class LinkButtonTheme : BaseButtonTheme
|
||||
// 普通状态
|
||||
{
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
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<PathIcon>());
|
||||
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<PathIcon>());
|
||||
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);
|
||||
}
|
||||
}
|
@ -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<PathIcon>());
|
||||
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<PathIcon>());
|
||||
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<PathIcon>());
|
||||
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);
|
||||
}
|
||||
}
|
@ -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<PathIcon>());
|
||||
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<PathIcon>());
|
||||
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);
|
||||
}
|
||||
}
|
@ -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<SolidColorBrushTransition>(IndicatorBorderBrushProperty),
|
||||
AnimationUtils.CreateTransition<SolidColorBrushTransition>(IndicatorTristateMarkBrushProperty),
|
||||
AnimationUtils.CreateTransition<DoubleTransition>(IndicatorCheckedMarkEffectSizeProperty,
|
||||
GlobalResourceKey.MotionDurationMid, new BackEaseOut())
|
||||
GlobalTokenResourceKey.MotionDurationMid, new BackEaseOut())
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -205,7 +205,7 @@ public class CollapseItem : HeaderedContentControl, ISelectable
|
||||
_animationTarget = e.NameScope.Find<AnimationTargetPanel>(CollapseItemTheme.ContentAnimationTargetPart);
|
||||
_headerDecorator = e.NameScope.Find<Border>(CollapseItemTheme.HeaderDecoratorPart);
|
||||
_expandButton = e.NameScope.Find<IconButton>(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);
|
||||
}
|
||||
|
@ -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<PathIcon>());
|
||||
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<ContentPresenter>());
|
||||
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<PathIcon>());
|
||||
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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
@ -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()
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -177,8 +177,8 @@ public class Expander : AvaloniaExpander
|
||||
_animationTarget = e.NameScope.Find<AnimationTargetPanel>(ExpanderTheme.ContentAnimationTargetPart);
|
||||
_headerDecorator = e.NameScope.Find<Border>(ExpanderTheme.HeaderDecoratorPart);
|
||||
_expandButton = e.NameScope.Find<IconButton>(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);
|
||||
}
|
||||
|
@ -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<PathIcon>());
|
||||
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<ContentPresenter>());
|
||||
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<PathIcon>());
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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");
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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<TextBlock>());
|
||||
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);
|
||||
}
|
||||
}
|
@ -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";
|
||||
}
|
@ -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 = "加载中";
|
||||
}
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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();
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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<IconButton>());
|
||||
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<IconButton>().Class(StdPseudoClass.PointerOver));
|
||||
iconButtonStyle.Add(IconButton.BackgroundProperty, MenuResourceKey.ItemHoverBg);
|
||||
iconButtonStyle.Add(IconButton.BackgroundProperty, MenuTokenResourceKey.ItemHoverBg);
|
||||
Add(iconButtonStyle);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
|
@ -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<ContentPresenter>().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<ContentPresenter>().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<ContentPresenter>().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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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<Label>());
|
||||
labelStyle.Add(Label.HorizontalAlignmentProperty, HorizontalAlignment.Center);
|
||||
|
@ -26,8 +26,8 @@ public class AbstractLineProgressTheme : AbstractProgressBarTheme
|
||||
HorizontalAlignment = HorizontalAlignment.Left
|
||||
};
|
||||
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
|
||||
{
|
||||
@ -36,8 +36,8 @@ public class AbstractLineProgressTheme : AbstractProgressBarTheme
|
||||
HorizontalAlignment = HorizontalAlignment.Left
|
||||
};
|
||||
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);
|
||||
@ -47,8 +47,8 @@ public class AbstractLineProgressTheme : AbstractProgressBarTheme
|
||||
{
|
||||
base.BuildStyles();
|
||||
var commonStyle = new Style(selector => selector.Nesting());
|
||||
commonStyle.Add(AbstractLineProgress.LineProgressPaddingProperty, ProgressBarResourceKey.LineProgressPadding);
|
||||
commonStyle.Add(AbstractLineProgress.LineExtraInfoMarginProperty, ProgressBarResourceKey.LineExtraInfoMargin);
|
||||
commonStyle.Add(AbstractLineProgress.LineProgressPaddingProperty, ProgressBarTokenResourceKey.LineProgressPadding);
|
||||
commonStyle.Add(AbstractLineProgress.LineExtraInfoMarginProperty, ProgressBarTokenResourceKey.LineExtraInfoMargin);
|
||||
Add(commonStyle);
|
||||
BuildSizeTypeStyle();
|
||||
}
|
||||
@ -56,41 +56,41 @@ public class AbstractLineProgressTheme : AbstractProgressBarTheme
|
||||
private void BuildSizeTypeStyle()
|
||||
{
|
||||
var largeSizeTypeStyle = new Style(selector => selector.Nesting().PropertyEquals(AbstractProgressBar.EffectiveSizeTypeProperty, SizeType.Large));
|
||||
largeSizeTypeStyle.Add(AbstractLineProgress.LineInfoIconSizeProperty, ProgressBarResourceKey.LineInfoIconSize);
|
||||
largeSizeTypeStyle.Add(AbstractLineProgress.LineInfoIconSizeProperty, ProgressBarTokenResourceKey.LineInfoIconSize);
|
||||
// icon
|
||||
{
|
||||
var completedIconsStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
completedIconsStyle.Add(PathIcon.WidthProperty, ProgressBarResourceKey.LineInfoIconSize);
|
||||
completedIconsStyle.Add(PathIcon.HeightProperty, ProgressBarResourceKey.LineInfoIconSize);
|
||||
completedIconsStyle.Add(PathIcon.WidthProperty, ProgressBarTokenResourceKey.LineInfoIconSize);
|
||||
completedIconsStyle.Add(PathIcon.HeightProperty, ProgressBarTokenResourceKey.LineInfoIconSize);
|
||||
largeSizeTypeStyle.Add(completedIconsStyle);
|
||||
}
|
||||
largeSizeTypeStyle.Add(Label.FontSizeProperty, GlobalResourceKey.FontSize);
|
||||
largeSizeTypeStyle.Add(Label.FontSizeProperty, GlobalTokenResourceKey.FontSize);
|
||||
|
||||
Add(largeSizeTypeStyle);
|
||||
|
||||
var middleTypeStyle = new Style(selector => selector.Nesting().PropertyEquals(AbstractProgressBar.EffectiveSizeTypeProperty, SizeType.Middle));
|
||||
middleTypeStyle.Add(AbstractLineProgress.LineInfoIconSizeProperty, ProgressBarResourceKey.LineInfoIconSize);
|
||||
middleTypeStyle.Add(AbstractLineProgress.LineInfoIconSizeProperty, ProgressBarTokenResourceKey.LineInfoIconSize);
|
||||
// icon
|
||||
{
|
||||
var completedIconsStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
completedIconsStyle.Add(PathIcon.WidthProperty, ProgressBarResourceKey.LineInfoIconSizeSM);
|
||||
completedIconsStyle.Add(PathIcon.HeightProperty, ProgressBarResourceKey.LineInfoIconSizeSM);
|
||||
completedIconsStyle.Add(PathIcon.WidthProperty, ProgressBarTokenResourceKey.LineInfoIconSizeSM);
|
||||
completedIconsStyle.Add(PathIcon.HeightProperty, ProgressBarTokenResourceKey.LineInfoIconSizeSM);
|
||||
middleTypeStyle.Add(completedIconsStyle);
|
||||
}
|
||||
|
||||
middleTypeStyle.Add(Label.FontSizeProperty, GlobalResourceKey.FontSizeSM);
|
||||
middleTypeStyle.Add(Label.FontSizeProperty, GlobalTokenResourceKey.FontSizeSM);
|
||||
Add(middleTypeStyle);
|
||||
|
||||
var smallTypeStyle = new Style(selector => selector.Nesting().PropertyEquals(AbstractProgressBar.EffectiveSizeTypeProperty, SizeType.Small));
|
||||
smallTypeStyle.Add(AbstractLineProgress.LineInfoIconSizeProperty, ProgressBarResourceKey.LineInfoIconSizeSM);
|
||||
smallTypeStyle.Add(AbstractLineProgress.LineInfoIconSizeProperty, ProgressBarTokenResourceKey.LineInfoIconSizeSM);
|
||||
// icon
|
||||
{
|
||||
var completedIconsStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
completedIconsStyle.Add(PathIcon.WidthProperty, ProgressBarResourceKey.LineInfoIconSizeSM);
|
||||
completedIconsStyle.Add(PathIcon.HeightProperty, ProgressBarResourceKey.LineInfoIconSizeSM);
|
||||
completedIconsStyle.Add(PathIcon.WidthProperty, ProgressBarTokenResourceKey.LineInfoIconSizeSM);
|
||||
completedIconsStyle.Add(PathIcon.HeightProperty, ProgressBarTokenResourceKey.LineInfoIconSizeSM);
|
||||
smallTypeStyle.Add(completedIconsStyle);
|
||||
}
|
||||
smallTypeStyle.Add(Label.FontSizeProperty, GlobalResourceKey.FontSizeSM);
|
||||
smallTypeStyle.Add(Label.FontSizeProperty, GlobalTokenResourceKey.FontSizeSM);
|
||||
Add(smallTypeStyle);
|
||||
}
|
||||
}
|
@ -362,8 +362,8 @@ public abstract class AbstractProgressBar : RangeBase,
|
||||
{
|
||||
var transitions = new Transitions();
|
||||
|
||||
transitions.Add(AnimationUtils.CreateTransition<DoubleTransition>(ValueProperty, GlobalResourceKey.MotionDurationVerySlow, new ExponentialEaseOut()));
|
||||
transitions.Add(AnimationUtils.CreateTransition<SolidColorBrushTransition>(IndicatorBarBrushProperty, GlobalResourceKey.MotionDurationFast));
|
||||
transitions.Add(AnimationUtils.CreateTransition<DoubleTransition>(ValueProperty, GlobalTokenResourceKey.MotionDurationVerySlow, new ExponentialEaseOut()));
|
||||
transitions.Add(AnimationUtils.CreateTransition<SolidColorBrushTransition>(IndicatorBarBrushProperty, GlobalTokenResourceKey.MotionDurationFast));
|
||||
|
||||
NotifySetupTransitions(ref transitions);
|
||||
Transitions = transitions;
|
||||
@ -426,7 +426,7 @@ public abstract class AbstractProgressBar : RangeBase,
|
||||
|
||||
protected virtual void NotifySetupTokenBindings()
|
||||
{
|
||||
TokenResourceBinder.CreateTokenBinding(this, SuccessThresholdBrushProperty, GlobalResourceKey.ColorSuccess);
|
||||
TokenResourceBinder.CreateTokenBinding(this, SuccessThresholdBrushProperty, GlobalTokenResourceKey.ColorSuccess);
|
||||
}
|
||||
|
||||
protected virtual void NotifyPropertyChanged(AvaloniaPropertyChangedEventArgs e)
|
||||
|
@ -61,8 +61,8 @@ public class AbstractProgressBarTheme : BaseControlTheme
|
||||
private void BuildCommonStyle()
|
||||
{
|
||||
var enabledStyle = new Style(selector => selector.Nesting().PropertyEquals(AbstractProgressBar.IsEnabledProperty, true));
|
||||
enabledStyle.Add(AbstractProgressBar.ForegroundProperty, GlobalResourceKey.ColorTextLabel);
|
||||
enabledStyle.Add(AbstractProgressBar.GrooveBrushProperty, ProgressBarResourceKey.RemainingColor);
|
||||
enabledStyle.Add(AbstractProgressBar.ForegroundProperty, GlobalTokenResourceKey.ColorTextLabel);
|
||||
enabledStyle.Add(AbstractProgressBar.GrooveBrushProperty, ProgressBarTokenResourceKey.RemainingColor);
|
||||
Add(enabledStyle);
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ public class AbstractProgressBarTheme : BaseControlTheme
|
||||
var infoLabelStyle = new Style(selector => selector.Nesting().Template().OfType<LayoutTransformControl>());
|
||||
infoLabelStyle.Add(LayoutTransformControl.IsVisibleProperty, false);
|
||||
|
||||
exceptionStatusStyle.Add(AbstractProgressBar.IndicatorBarBrushProperty, GlobalResourceKey.ColorError);
|
||||
exceptionStatusStyle.Add(AbstractProgressBar.IndicatorBarBrushProperty, GlobalTokenResourceKey.ColorError);
|
||||
|
||||
exceptionStatusStyle.Add(infoLabelStyle);
|
||||
}
|
||||
@ -102,7 +102,7 @@ public class AbstractProgressBarTheme : BaseControlTheme
|
||||
var infoLabelStyle = new Style(selector => selector.Nesting().Template().OfType<LayoutTransformControl>());
|
||||
infoLabelStyle.Add(LayoutTransformControl.IsVisibleProperty, false);
|
||||
|
||||
successStatusStyle.Add(AbstractProgressBar.IndicatorBarBrushProperty, GlobalResourceKey.ColorSuccess);
|
||||
successStatusStyle.Add(AbstractProgressBar.IndicatorBarBrushProperty, GlobalTokenResourceKey.ColorSuccess);
|
||||
|
||||
successStatusStyle.Add(infoLabelStyle);
|
||||
}
|
||||
@ -124,14 +124,14 @@ public class AbstractProgressBarTheme : BaseControlTheme
|
||||
}
|
||||
{
|
||||
var completedStyle = new Style(selector => selector.Nesting().Class(AbstractProgressBar.CompletedPC));
|
||||
completedStyle.Add(AbstractProgressBar.IndicatorBarBrushProperty, GlobalResourceKey.ColorSuccess);
|
||||
completedStyle.Add(AbstractProgressBar.IndicatorBarBrushProperty, GlobalTokenResourceKey.ColorSuccess);
|
||||
var successIconStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>().Name(SuccessCompletedIconPart));
|
||||
successIconStyle.Add(PathIcon.IsVisibleProperty, true);
|
||||
completedStyle.Add(successIconStyle);
|
||||
normalOrActiveStatusStyle.Add(completedStyle);
|
||||
}
|
||||
|
||||
normalOrActiveStatusStyle.Add(AbstractProgressBar.IndicatorBarBrushProperty, ProgressBarResourceKey.DefaultColor);
|
||||
normalOrActiveStatusStyle.Add(AbstractProgressBar.IndicatorBarBrushProperty, ProgressBarTokenResourceKey.DefaultColor);
|
||||
}
|
||||
Add(normalOrActiveStatusStyle);
|
||||
}
|
||||
@ -148,9 +148,9 @@ public class AbstractProgressBarTheme : BaseControlTheme
|
||||
private void BuildDisabledStyle()
|
||||
{
|
||||
var disableStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Disabled));
|
||||
disableStyle.Add(AbstractProgressBar.GrooveBrushProperty, GlobalResourceKey.ColorBgContainerDisabled);
|
||||
disableStyle.Add(AbstractProgressBar.IndicatorBarBrushProperty, GlobalResourceKey.ControlItemBgActiveDisabled);
|
||||
disableStyle.Add(AbstractProgressBar.ForegroundProperty, GlobalResourceKey.ColorTextDisabled);
|
||||
disableStyle.Add(AbstractProgressBar.GrooveBrushProperty, GlobalTokenResourceKey.ColorBgContainerDisabled);
|
||||
disableStyle.Add(AbstractProgressBar.IndicatorBarBrushProperty, GlobalTokenResourceKey.ControlItemBgActiveDisabled);
|
||||
disableStyle.Add(AbstractProgressBar.ForegroundProperty, GlobalTokenResourceKey.ColorTextDisabled);
|
||||
var statusIconStyle = new Style(selector => selector.Nesting().Template().OfType<PathIcon>());
|
||||
statusIconStyle.Add(PathIcon.IconModeProperty, IconMode.Disabled);
|
||||
disableStyle.Add(statusIconStyle);
|
||||
|
@ -241,13 +241,13 @@ public class ProgressBar : AbstractLineProgress
|
||||
double fontSize = default;
|
||||
double fontSizeSM = default;
|
||||
{
|
||||
if (TokenResourceUtils.FindGlobalTokenResource(GlobalResourceKey.FontSize) is double value) {
|
||||
if (TokenResourceUtils.FindGlobalTokenResource(GlobalTokenResourceKey.FontSize) is double value) {
|
||||
fontSize = value;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
if (TokenResourceUtils.FindGlobalTokenResource(GlobalResourceKey.FontSizeSM) is double value) {
|
||||
if (TokenResourceUtils.FindGlobalTokenResource(GlobalTokenResourceKey.FontSizeSM) is double value) {
|
||||
fontSizeSM = value;
|
||||
}
|
||||
}
|
||||
|
@ -15,8 +15,8 @@ public class ProgressBarTheme : AbstractLineProgressTheme
|
||||
{
|
||||
base.BuildStyles();
|
||||
var commonStyle = new Style(selector => selector.Nesting());
|
||||
commonStyle.Add(ProgressBar.ColorTextLabelProperty, GlobalResourceKey.ColorTextLabel);
|
||||
commonStyle.Add(ProgressBar.ColorTextLightSolidProperty, GlobalResourceKey.ColorTextLightSolid);
|
||||
commonStyle.Add(ProgressBar.ColorTextLabelProperty, GlobalTokenResourceKey.ColorTextLabel);
|
||||
commonStyle.Add(ProgressBar.ColorTextLightSolidProperty, GlobalTokenResourceKey.ColorTextLightSolid);
|
||||
Add(commonStyle);
|
||||
BuildPercentPositionStyle();
|
||||
BuildCompletedIconStyle();
|
||||
|
@ -168,13 +168,13 @@ public class StepsProgressBar : AbstractLineProgress
|
||||
double fontSize = default;
|
||||
double fontSizeSM = default;
|
||||
{
|
||||
if (TokenResourceUtils.FindGlobalTokenResource(GlobalResourceKey.FontSize) is double value) {
|
||||
if (TokenResourceUtils.FindGlobalTokenResource(GlobalTokenResourceKey.FontSize) is double value) {
|
||||
fontSize = value;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
if (TokenResourceUtils.FindGlobalTokenResource(GlobalResourceKey.FontSizeSM) is double value) {
|
||||
if (TokenResourceUtils.FindGlobalTokenResource(GlobalTokenResourceKey.FontSizeSM) is double value) {
|
||||
fontSizeSM = value;
|
||||
}
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ public class RadioButton : AvaloniaRadioButton,
|
||||
void IControlCustomStyle.HandleTemplateApplied(INameScope scope)
|
||||
{
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(this, RadioBorderThicknessProperty,
|
||||
GlobalResourceKey.BorderThickness, BindingPriority.Template,
|
||||
GlobalTokenResourceKey.BorderThickness, BindingPriority.Template,
|
||||
new RenderScaleAwareThicknessConfigure(this));
|
||||
Cursor = new Cursor(StandardCursorType.Hand);
|
||||
_customStyle.CollectStyleState();
|
||||
@ -231,7 +231,7 @@ public class RadioButton : AvaloniaRadioButton,
|
||||
AnimationUtils.CreateTransition<SolidColorBrushTransition>(RadioBorderBrushProperty),
|
||||
AnimationUtils.CreateTransition<DoubleTransition>(RadioDotEffectSizeProperty),
|
||||
AnimationUtils.CreateTransition<SolidColorBrushTransition>(RadioBackgroundProperty,
|
||||
GlobalResourceKey.MotionDurationFast)
|
||||
GlobalTokenResourceKey.MotionDurationFast)
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -14,11 +14,11 @@ internal class RadioButtonTheme : BaseControlTheme
|
||||
|
||||
protected override void BuildStyles()
|
||||
{
|
||||
this.Add(RadioButton.RadioSizeProperty, RadioButtonResourceKey.RadioSize);
|
||||
this.Add(RadioButton.PaddingInlineProperty, GlobalResourceKey.PaddingXS);
|
||||
this.Add(RadioButton.RadioBorderBrushProperty, GlobalResourceKey.ColorBorder);
|
||||
this.Add(RadioButton.DotSizeValueProperty, RadioButtonResourceKey.DotSize);
|
||||
this.Add(RadioButton.DotPaddingProperty, RadioButtonResourceKey.DotPadding);
|
||||
this.Add(RadioButton.RadioSizeProperty, RadioButtonTokenResourceKey.RadioSize);
|
||||
this.Add(RadioButton.PaddingInlineProperty, GlobalTokenResourceKey.PaddingXS);
|
||||
this.Add(RadioButton.RadioBorderBrushProperty, GlobalTokenResourceKey.ColorBorder);
|
||||
this.Add(RadioButton.DotSizeValueProperty, RadioButtonTokenResourceKey.DotSize);
|
||||
this.Add(RadioButton.DotPaddingProperty, RadioButtonTokenResourceKey.DotPadding);
|
||||
BuildEnabledStyle();
|
||||
BuildDisabledStyle();
|
||||
}
|
||||
@ -26,9 +26,9 @@ internal class RadioButtonTheme : BaseControlTheme
|
||||
private void BuildDisabledStyle()
|
||||
{
|
||||
var disableStyle = new Style(selector => selector.Nesting().PropertyEquals(RadioButton.IsEnabledProperty, false));
|
||||
disableStyle.Add(RadioButton.ForegroundProperty, GlobalResourceKey.ColorTextDisabled);
|
||||
disableStyle.Add(RadioButton.RadioBackgroundProperty, GlobalResourceKey.ColorBgContainerDisabled);
|
||||
disableStyle.Add(RadioButton.RadioInnerBackgroundProperty, RadioButtonResourceKey.DotColorDisabled);
|
||||
disableStyle.Add(RadioButton.ForegroundProperty, GlobalTokenResourceKey.ColorTextDisabled);
|
||||
disableStyle.Add(RadioButton.RadioBackgroundProperty, GlobalTokenResourceKey.ColorBgContainerDisabled);
|
||||
disableStyle.Add(RadioButton.RadioInnerBackgroundProperty, RadioButtonTokenResourceKey.DotColorDisabled);
|
||||
Add(disableStyle);
|
||||
}
|
||||
|
||||
@ -36,21 +36,21 @@ internal class RadioButtonTheme : BaseControlTheme
|
||||
{
|
||||
|
||||
var enabledStyle = new Style(selector => selector.Nesting().PropertyEquals(RadioButton.IsEnabledProperty, true));
|
||||
enabledStyle.Add(RadioButton.RadioInnerBackgroundProperty, RadioButtonResourceKey.RadioColor);
|
||||
enabledStyle.Add(RadioButton.RadioInnerBackgroundProperty, RadioButtonTokenResourceKey.RadioColor);
|
||||
|
||||
|
||||
// 选中
|
||||
var checkedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Checked));
|
||||
checkedStyle.Add(RadioButton.RadioBorderBrushProperty, GlobalResourceKey.ColorPrimary);
|
||||
checkedStyle.Add(RadioButton.RadioBackgroundProperty, GlobalResourceKey.ColorPrimary);
|
||||
checkedStyle.Add(RadioButton.RadioBorderBrushProperty, GlobalTokenResourceKey.ColorPrimary);
|
||||
checkedStyle.Add(RadioButton.RadioBackgroundProperty, GlobalTokenResourceKey.ColorPrimary);
|
||||
|
||||
enabledStyle.Add(checkedStyle);
|
||||
|
||||
// 没选中
|
||||
var unCheckedStyle = new Style(selector => selector.Nesting().Not(x=> x.Nesting().Class(StdPseudoClass.Checked)));
|
||||
unCheckedStyle.Add(RadioButton.RadioBackgroundProperty, GlobalResourceKey.ColorBgContainer);
|
||||
unCheckedStyle.Add(RadioButton.RadioBackgroundProperty, GlobalTokenResourceKey.ColorBgContainer);
|
||||
var unCheckedHoverStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver));
|
||||
unCheckedHoverStyle.Add(RadioButton.RadioBorderBrushProperty, GlobalResourceKey.ColorPrimary);
|
||||
unCheckedHoverStyle.Add(RadioButton.RadioBorderBrushProperty, GlobalTokenResourceKey.ColorPrimary);
|
||||
unCheckedStyle.Add(unCheckedHoverStyle);
|
||||
|
||||
enabledStyle.Add(unCheckedStyle);
|
||||
|
@ -592,7 +592,7 @@ public partial class Segmented : TemplatedControl, IControlCustomStyle
|
||||
Transitions = new Transitions()
|
||||
{
|
||||
AnimationUtils.CreateTransition<PointTransition>(SelectedThumbPosProperty),
|
||||
AnimationUtils.CreateTransition<SizeTransition>(SelectedThumbSizeProperty, GlobalResourceKey.MotionDurationFast)
|
||||
AnimationUtils.CreateTransition<SizeTransition>(SelectedThumbSizeProperty, GlobalTokenResourceKey.MotionDurationFast)
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -177,9 +177,9 @@ public class SegmentedItem : TemplatedControl, IControlCustomStyle
|
||||
{
|
||||
if (Icon is not null) {
|
||||
if (Icon.ThemeType != IconThemeType.TwoTone) {
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.NormalFilledBrushProperty, SegmentedResourceKey.ItemColor);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.ActiveFilledBrushProperty, SegmentedResourceKey.ItemHoverColor);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.SelectedFilledBrushProperty, SegmentedResourceKey.ItemSelectedColor);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.NormalFilledBrushProperty, SegmentedTokenResourceKey.ItemColor);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.ActiveFilledBrushProperty, SegmentedTokenResourceKey.ItemHoverColor);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.SelectedFilledBrushProperty, SegmentedTokenResourceKey.ItemSelectedColor);
|
||||
}
|
||||
|
||||
if (_mainLayout is not null) {
|
||||
|
@ -31,30 +31,30 @@ public class SegmentedItemBoxTheme : BaseControlTheme
|
||||
protected override void BuildStyles()
|
||||
{
|
||||
var commonStyle = new Style(selector => selector.Nesting());
|
||||
commonStyle.Add(SegmentedItemBox.TrackPaddingProperty, SegmentedResourceKey.TrackPadding);
|
||||
commonStyle.Add(SegmentedItemBox.TrackPaddingProperty, SegmentedTokenResourceKey.TrackPadding);
|
||||
// 没有被选择的正常状态
|
||||
var enabledStyle = new Style(selector => selector.Nesting().PropertyEquals(SegmentedItemBox.IsEnabledProperty, true));
|
||||
|
||||
// 选中状态
|
||||
var selectedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Selected));
|
||||
selectedStyle.Add(SegmentedItemBox.ForegroundProperty, SegmentedResourceKey.ItemSelectedColor);
|
||||
selectedStyle.Add(SegmentedItemBox.BackgroundProperty, GlobalResourceKey.ColorTransparent);
|
||||
selectedStyle.Add(SegmentedItemBox.ForegroundProperty, SegmentedTokenResourceKey.ItemSelectedColor);
|
||||
selectedStyle.Add(SegmentedItemBox.BackgroundProperty, GlobalTokenResourceKey.ColorTransparent);
|
||||
enabledStyle.Add(selectedStyle);
|
||||
|
||||
// 没有被选中的状态
|
||||
var notSelectedStyle = new Style(selector => selector.Nesting().Not(x => x.Nesting().Class(StdPseudoClass.Selected)));
|
||||
notSelectedStyle.Add(SegmentedItemBox.BackgroundProperty, GlobalResourceKey.ColorTransparent);
|
||||
notSelectedStyle.Add(SegmentedItemBox.ForegroundProperty, SegmentedResourceKey.ItemColor);
|
||||
notSelectedStyle.Add(SegmentedItemBox.BackgroundProperty, GlobalTokenResourceKey.ColorTransparent);
|
||||
notSelectedStyle.Add(SegmentedItemBox.ForegroundProperty, SegmentedTokenResourceKey.ItemColor);
|
||||
|
||||
// Hover 状态
|
||||
var hoverStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver));
|
||||
hoverStyle.Add(SegmentedItemBox.BackgroundProperty, SegmentedResourceKey.ItemHoverBg);
|
||||
hoverStyle.Add(SegmentedItemBox.ForegroundProperty, SegmentedResourceKey.ItemHoverColor);
|
||||
hoverStyle.Add(SegmentedItemBox.BackgroundProperty, SegmentedTokenResourceKey.ItemHoverBg);
|
||||
hoverStyle.Add(SegmentedItemBox.ForegroundProperty, SegmentedTokenResourceKey.ItemHoverColor);
|
||||
notSelectedStyle.Add(hoverStyle);
|
||||
|
||||
// Pressed 状态
|
||||
var pressedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Pressed));
|
||||
pressedStyle.Add(SegmentedItemBox.BackgroundProperty, SegmentedResourceKey.ItemActiveBg);
|
||||
pressedStyle.Add(SegmentedItemBox.BackgroundProperty, SegmentedTokenResourceKey.ItemActiveBg);
|
||||
notSelectedStyle.Add(pressedStyle);
|
||||
|
||||
enabledStyle.Add(notSelectedStyle);
|
||||
@ -69,26 +69,26 @@ public class SegmentedItemBoxTheme : BaseControlTheme
|
||||
{
|
||||
var largeSizeStyle =
|
||||
new Style(selector => selector.Nesting().PropertyEquals(SegmentedItemBox.SizeTypeProperty, SizeType.Large));
|
||||
largeSizeStyle.Add(SegmentedItemBox.CornerRadiusProperty, GlobalResourceKey.BorderRadius);
|
||||
largeSizeStyle.Add(SegmentedItemBox.FontSizeProperty, GlobalResourceKey.FontSizeLG);
|
||||
largeSizeStyle.Add(SegmentedItemBox.ControlHeightProperty, GlobalResourceKey.ControlHeightLG);
|
||||
largeSizeStyle.Add(SegmentedItemBox.SegmentedItemPaddingProperty, SegmentedResourceKey.SegmentedItemPadding);
|
||||
largeSizeStyle.Add(SegmentedItemBox.CornerRadiusProperty, GlobalTokenResourceKey.BorderRadius);
|
||||
largeSizeStyle.Add(SegmentedItemBox.FontSizeProperty, GlobalTokenResourceKey.FontSizeLG);
|
||||
largeSizeStyle.Add(SegmentedItemBox.ControlHeightProperty, GlobalTokenResourceKey.ControlHeightLG);
|
||||
largeSizeStyle.Add(SegmentedItemBox.SegmentedItemPaddingProperty, SegmentedTokenResourceKey.SegmentedItemPadding);
|
||||
Add(largeSizeStyle);
|
||||
|
||||
var middleSizeStyle =
|
||||
new Style(selector => selector.Nesting().PropertyEquals(SegmentedItemBox.SizeTypeProperty, SizeType.Middle));
|
||||
middleSizeStyle.Add(SegmentedItemBox.CornerRadiusProperty, GlobalResourceKey.BorderRadiusSM);
|
||||
middleSizeStyle.Add(SegmentedItemBox.FontSizeProperty, GlobalResourceKey.FontSize);
|
||||
middleSizeStyle.Add(SegmentedItemBox.ControlHeightProperty, GlobalResourceKey.ControlHeight);
|
||||
middleSizeStyle.Add(SegmentedItemBox.SegmentedItemPaddingProperty, SegmentedResourceKey.SegmentedItemPadding);
|
||||
middleSizeStyle.Add(SegmentedItemBox.CornerRadiusProperty, GlobalTokenResourceKey.BorderRadiusSM);
|
||||
middleSizeStyle.Add(SegmentedItemBox.FontSizeProperty, GlobalTokenResourceKey.FontSize);
|
||||
middleSizeStyle.Add(SegmentedItemBox.ControlHeightProperty, GlobalTokenResourceKey.ControlHeight);
|
||||
middleSizeStyle.Add(SegmentedItemBox.SegmentedItemPaddingProperty, SegmentedTokenResourceKey.SegmentedItemPadding);
|
||||
Add(middleSizeStyle);
|
||||
|
||||
var smallSizeStyle =
|
||||
new Style(selector => selector.Nesting().PropertyEquals(SegmentedItemBox.SizeTypeProperty, SizeType.Small));
|
||||
smallSizeStyle.Add(SegmentedItemBox.CornerRadiusProperty, GlobalResourceKey.BorderRadiusXS);
|
||||
smallSizeStyle.Add(SegmentedItemBox.FontSizeProperty, GlobalResourceKey.FontSize);
|
||||
smallSizeStyle.Add(SegmentedItemBox.ControlHeightProperty, GlobalResourceKey.ControlHeightSM);
|
||||
smallSizeStyle.Add(SegmentedItemBox.SegmentedItemPaddingProperty, SegmentedResourceKey.SegmentedItemPaddingSM);
|
||||
smallSizeStyle.Add(SegmentedItemBox.CornerRadiusProperty, GlobalTokenResourceKey.BorderRadiusXS);
|
||||
smallSizeStyle.Add(SegmentedItemBox.FontSizeProperty, GlobalTokenResourceKey.FontSize);
|
||||
smallSizeStyle.Add(SegmentedItemBox.ControlHeightProperty, GlobalTokenResourceKey.ControlHeightSM);
|
||||
smallSizeStyle.Add(SegmentedItemBox.SegmentedItemPaddingProperty, SegmentedTokenResourceKey.SegmentedItemPaddingSM);
|
||||
|
||||
Add(smallSizeStyle);
|
||||
}
|
||||
@ -96,7 +96,7 @@ public class SegmentedItemBoxTheme : BaseControlTheme
|
||||
private void BuildDisabledStyle()
|
||||
{
|
||||
var disabledStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Disabled));
|
||||
disabledStyle.Add(SegmentedItemBox.ForegroundProperty, GlobalResourceKey.ColorTextDisabled);
|
||||
disabledStyle.Add(SegmentedItemBox.ForegroundProperty, GlobalTokenResourceKey.ColorTextDisabled);
|
||||
Add(disabledStyle);
|
||||
}
|
||||
}
|
@ -48,7 +48,7 @@ internal class SegmentedItemTheme : BaseControlTheme
|
||||
var hasIconStyle = new Style(selector => selector.Nesting().Not(x => x.Nesting().PropertyEquals(SegmentedItem.IconProperty, null)));
|
||||
{
|
||||
var labelStyle = new Style(selector => selector.Nesting().Template().OfType<Label>());
|
||||
labelStyle.Add(Label.MarginProperty, SegmentedResourceKey.SegmentedTextLabelMargin);
|
||||
labelStyle.Add(Label.MarginProperty, SegmentedTokenResourceKey.SegmentedTextLabelMargin);
|
||||
hasIconStyle.Add(labelStyle);
|
||||
}
|
||||
|
||||
@ -68,8 +68,8 @@ internal class SegmentedItemTheme : BaseControlTheme
|
||||
new Style(selector => selector.Nesting().PropertyEquals(SegmentedItem.SizeTypeProperty, SizeType.Large));
|
||||
{
|
||||
var iconStyle = new Style(selector => iconSelector);
|
||||
iconStyle.Add(PathIcon.WidthProperty, GlobalResourceKey.IconSizeLG);
|
||||
iconStyle.Add(PathIcon.HeightProperty, GlobalResourceKey.IconSizeLG);
|
||||
iconStyle.Add(PathIcon.WidthProperty, GlobalTokenResourceKey.IconSizeLG);
|
||||
iconStyle.Add(PathIcon.HeightProperty, GlobalTokenResourceKey.IconSizeLG);
|
||||
largeSizeStyle.Add(iconStyle);
|
||||
}
|
||||
Add(largeSizeStyle);
|
||||
@ -78,8 +78,8 @@ internal class SegmentedItemTheme : BaseControlTheme
|
||||
new Style(selector => selector.Nesting().PropertyEquals(SegmentedItem.SizeTypeProperty, SizeType.Middle));
|
||||
{
|
||||
var iconStyle = new Style(selector => iconSelector);
|
||||
iconStyle.Add(PathIcon.WidthProperty, GlobalResourceKey.IconSize);
|
||||
iconStyle.Add(PathIcon.HeightProperty, GlobalResourceKey.IconSize);
|
||||
iconStyle.Add(PathIcon.WidthProperty, GlobalTokenResourceKey.IconSize);
|
||||
iconStyle.Add(PathIcon.HeightProperty, GlobalTokenResourceKey.IconSize);
|
||||
middleSizeStyle.Add(iconStyle);
|
||||
}
|
||||
Add(middleSizeStyle);
|
||||
@ -88,8 +88,8 @@ internal class SegmentedItemTheme : BaseControlTheme
|
||||
new Style(selector => selector.Nesting().PropertyEquals(SegmentedItem.SizeTypeProperty, SizeType.Small));
|
||||
{
|
||||
var iconStyle = new Style(selector => iconSelector);
|
||||
iconStyle.Add(PathIcon.WidthProperty, GlobalResourceKey.IconSizeSM);
|
||||
iconStyle.Add(PathIcon.HeightProperty, GlobalResourceKey.IconSizeSM);
|
||||
iconStyle.Add(PathIcon.WidthProperty, GlobalTokenResourceKey.IconSizeSM);
|
||||
iconStyle.Add(PathIcon.HeightProperty, GlobalTokenResourceKey.IconSizeSM);
|
||||
smallSizeStyle.Add(iconStyle);
|
||||
}
|
||||
Add(smallSizeStyle);
|
||||
|
@ -34,11 +34,11 @@ public class SegmentedTheme : BaseControlTheme
|
||||
protected override void BuildStyles()
|
||||
{
|
||||
var commonStyle = new Style(selector => selector.Nesting());
|
||||
commonStyle.Add(Segmented.PaddingProperty, SegmentedResourceKey.TrackPadding);
|
||||
commonStyle.Add(Segmented.BackgroundProperty, SegmentedResourceKey.TrackBg);
|
||||
commonStyle.Add(Segmented.PaddingProperty, SegmentedTokenResourceKey.TrackPadding);
|
||||
commonStyle.Add(Segmented.BackgroundProperty, SegmentedTokenResourceKey.TrackBg);
|
||||
commonStyle.Add(Segmented.HorizontalAlignmentProperty, HorizontalAlignment.Left);
|
||||
commonStyle.Add(Segmented.SelectedThumbBgProperty, SegmentedResourceKey.ItemSelectedBg);
|
||||
commonStyle.Add(Segmented.SelectedThumbBoxShadowsProperty, GlobalResourceKey.BoxShadowsTertiary);
|
||||
commonStyle.Add(Segmented.SelectedThumbBgProperty, SegmentedTokenResourceKey.ItemSelectedBg);
|
||||
commonStyle.Add(Segmented.SelectedThumbBoxShadowsProperty, GlobalTokenResourceKey.BoxShadowsTertiary);
|
||||
var expandingStyle = new Style(selector => selector.Nesting().PropertyEquals(Segmented.IsExpandingProperty, true));
|
||||
expandingStyle.Add(Segmented.HorizontalAlignmentProperty, HorizontalAlignment.Stretch);
|
||||
commonStyle.Add(expandingStyle);
|
||||
@ -50,18 +50,18 @@ public class SegmentedTheme : BaseControlTheme
|
||||
private void BuildSizeTypeStyle()
|
||||
{
|
||||
var largeSizeTypeStyle = new Style(selector => selector.Nesting().PropertyEquals(Segmented.SizeTypeProperty, SizeType.Large));
|
||||
largeSizeTypeStyle.Add(Segmented.CornerRadiusProperty, GlobalResourceKey.BorderRadiusLG);
|
||||
largeSizeTypeStyle.Add(Segmented.SelectedThumbCornerRadiusProperty, GlobalResourceKey.BorderRadius);
|
||||
largeSizeTypeStyle.Add(Segmented.CornerRadiusProperty, GlobalTokenResourceKey.BorderRadiusLG);
|
||||
largeSizeTypeStyle.Add(Segmented.SelectedThumbCornerRadiusProperty, GlobalTokenResourceKey.BorderRadius);
|
||||
Add(largeSizeTypeStyle);
|
||||
|
||||
var middleSizeTypeStyle = new Style(selector => selector.Nesting().PropertyEquals(Segmented.SizeTypeProperty, SizeType.Middle));
|
||||
middleSizeTypeStyle.Add(Segmented.CornerRadiusProperty, GlobalResourceKey.BorderRadius);
|
||||
middleSizeTypeStyle.Add(Segmented.SelectedThumbCornerRadiusProperty, GlobalResourceKey.BorderRadiusSM);
|
||||
middleSizeTypeStyle.Add(Segmented.CornerRadiusProperty, GlobalTokenResourceKey.BorderRadius);
|
||||
middleSizeTypeStyle.Add(Segmented.SelectedThumbCornerRadiusProperty, GlobalTokenResourceKey.BorderRadiusSM);
|
||||
Add(middleSizeTypeStyle);
|
||||
|
||||
var smallSizeTypeStyle = new Style(selector => selector.Nesting().PropertyEquals(Segmented.SizeTypeProperty, SizeType.Small));
|
||||
smallSizeTypeStyle.Add(Segmented.CornerRadiusProperty, GlobalResourceKey.BorderRadiusSM);
|
||||
smallSizeTypeStyle.Add(Segmented.SelectedThumbCornerRadiusProperty, GlobalResourceKey.BorderRadiusXS);
|
||||
smallSizeTypeStyle.Add(Segmented.CornerRadiusProperty, GlobalTokenResourceKey.BorderRadiusSM);
|
||||
smallSizeTypeStyle.Add(Segmented.SelectedThumbCornerRadiusProperty, GlobalTokenResourceKey.BorderRadiusXS);
|
||||
Add(smallSizeTypeStyle);
|
||||
}
|
||||
}
|
@ -205,7 +205,7 @@ public class Separator : AvaloniaSeparator, IControlCustomStyle
|
||||
|
||||
void IControlCustomStyle.SetupTokenBindings()
|
||||
{
|
||||
TokenResourceBinder.CreateTokenBinding(this, LineWidthProperty, GlobalResourceKey.LineWidth);
|
||||
TokenResourceBinder.CreateTokenBinding(this, LineWidthProperty, GlobalTokenResourceKey.LineWidth);
|
||||
}
|
||||
|
||||
// 当为水平分隔线的时候,我们设置最小的高度,当为垂直分割线的时候我们设置一个合适宽度
|
||||
|
@ -43,12 +43,12 @@ internal class SeparatorTheme : BaseControlTheme
|
||||
protected override void BuildStyles()
|
||||
{
|
||||
// 默认的一些样式
|
||||
this.Add(Separator.TitleColorProperty, GlobalResourceKey.ColorText);
|
||||
this.Add(Separator.FontSizeProperty, GlobalResourceKey.FontSize);
|
||||
this.Add(Separator.LineColorProperty, GlobalResourceKey.ColorSplit);
|
||||
this.Add(Separator.TextPaddingInlineProperty, SeparatorResourceKey.TextPaddingInline);
|
||||
this.Add(Separator.OrientationMarginPercentProperty, SeparatorResourceKey.OrientationMarginPercent);
|
||||
this.Add(Separator.VerticalMarginInlineProperty, SeparatorResourceKey.VerticalMarginInline);
|
||||
this.Add(Separator.TitleColorProperty, GlobalTokenResourceKey.ColorText);
|
||||
this.Add(Separator.FontSizeProperty, GlobalTokenResourceKey.FontSize);
|
||||
this.Add(Separator.LineColorProperty, GlobalTokenResourceKey.ColorSplit);
|
||||
this.Add(Separator.TextPaddingInlineProperty, SeparatorTokenResourceKey.TextPaddingInline);
|
||||
this.Add(Separator.OrientationMarginPercentProperty, SeparatorTokenResourceKey.OrientationMarginPercent);
|
||||
this.Add(Separator.VerticalMarginInlineProperty, SeparatorTokenResourceKey.VerticalMarginInline);
|
||||
|
||||
var titleSelector = default(Selector).Nesting().Template().OfType<Label>().Name(TitlePart);
|
||||
var horizontalStyle =
|
||||
|
@ -87,32 +87,32 @@ internal class SliderTheme : BaseControlTheme
|
||||
private void BuildSliderTrackStyle(Style sliderStyle)
|
||||
{
|
||||
var sliderTrackStyle = new Style(selector => selector.Nesting().Template().OfType<SliderTrack>());
|
||||
sliderTrackStyle.Add(SliderTrack.TrackGrooveBrushProperty, SliderResourceKey.RailBg);
|
||||
sliderTrackStyle.Add(SliderTrack.TrackBarBrushProperty, SliderResourceKey.TrackBg);
|
||||
sliderTrackStyle.Add(SliderTrack.MarkBorderBrushProperty, SliderResourceKey.MarkBorderColor);
|
||||
sliderTrackStyle.Add(SliderTrack.MarkBorderActiveBrushProperty, SliderResourceKey.MarkBorderColorActive);
|
||||
sliderTrackStyle.Add(SliderTrack.TrackGrooveBrushProperty, SliderTokenResourceKey.RailBg);
|
||||
sliderTrackStyle.Add(SliderTrack.TrackBarBrushProperty, SliderTokenResourceKey.TrackBg);
|
||||
sliderTrackStyle.Add(SliderTrack.MarkBorderBrushProperty, SliderTokenResourceKey.MarkBorderColor);
|
||||
sliderTrackStyle.Add(SliderTrack.MarkBorderActiveBrushProperty, SliderTokenResourceKey.MarkBorderColorActive);
|
||||
sliderStyle.Add(sliderTrackStyle);
|
||||
|
||||
var sliderStyleHover = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver));
|
||||
var thumbStyle = new Style(selector => selector.Nesting().Template().OfType<SliderThumb>().PropertyEquals(SliderThumb.IsFocusedProperty, false)
|
||||
.Not(x => x.Class(StdPseudoClass.PointerOver)));
|
||||
thumbStyle.Add(SliderThumb.BorderBrushProperty, SliderResourceKey.ThumbCircleBorderHoverColor);
|
||||
thumbStyle.Add(SliderThumb.BorderBrushProperty, SliderTokenResourceKey.ThumbCircleBorderHoverColor);
|
||||
sliderStyleHover.Add(thumbStyle);
|
||||
sliderStyle.Add(sliderStyleHover);
|
||||
|
||||
|
||||
var sliderTrackHorizontalStyle = new Style(selector => selector.Nesting().Template().OfType<SliderTrack>().Class(StdPseudoClass.Horizontal));
|
||||
sliderTrackHorizontalStyle.Add(SliderTrack.PaddingProperty, SliderResourceKey.SliderPaddingHorizontal);
|
||||
sliderTrackHorizontalStyle.Add(SliderTrack.PaddingProperty, SliderTokenResourceKey.SliderPaddingHorizontal);
|
||||
sliderStyle.Add(sliderTrackHorizontalStyle);
|
||||
|
||||
var sliderTrackVerticalStyle = new Style(selector => selector.Nesting().Template().OfType<SliderTrack>().Class(StdPseudoClass.Vertical));
|
||||
sliderTrackVerticalStyle.Add(SliderTrack.PaddingProperty, SliderResourceKey.SliderPaddingVertical);
|
||||
sliderTrackVerticalStyle.Add(SliderTrack.PaddingProperty, SliderTokenResourceKey.SliderPaddingVertical);
|
||||
sliderStyle.Add(sliderTrackVerticalStyle);
|
||||
|
||||
var sliderTrackHoverStyle = new Style(selector => selector.Nesting().Template().OfType<SliderTrack>().Class(StdPseudoClass.PointerOver));
|
||||
sliderTrackHoverStyle.Add(SliderTrack.TrackGrooveBrushProperty, SliderResourceKey.RailHoverBg);
|
||||
sliderTrackHoverStyle.Add(SliderTrack.TrackBarBrushProperty, SliderResourceKey.TrackHoverBg);
|
||||
sliderTrackHoverStyle.Add(SliderTrack.MarkBorderBrushProperty, SliderResourceKey.MarkBorderColorHover);
|
||||
sliderTrackHoverStyle.Add(SliderTrack.TrackGrooveBrushProperty, SliderTokenResourceKey.RailHoverBg);
|
||||
sliderTrackHoverStyle.Add(SliderTrack.TrackBarBrushProperty, SliderTokenResourceKey.TrackHoverBg);
|
||||
sliderTrackHoverStyle.Add(SliderTrack.MarkBorderBrushProperty, SliderTokenResourceKey.MarkBorderColorHover);
|
||||
sliderTrackHoverStyle.Add(SliderTrack.CursorProperty, new Cursor(StandardCursorType.Hand));
|
||||
sliderStyle.Add(sliderTrackHoverStyle);
|
||||
}
|
||||
@ -122,12 +122,12 @@ internal class SliderTheme : BaseControlTheme
|
||||
var disabledStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Disabled));
|
||||
|
||||
var sliderTrackStyle = new Style(selector => selector.Nesting().Template().OfType<SliderTrack>());
|
||||
sliderTrackStyle.Add(SliderTrack.TrackBarBrushProperty, SliderResourceKey.TrackBgDisabled);
|
||||
sliderTrackStyle.Add(SliderTrack.MarkBorderActiveBrushProperty, SliderResourceKey.ThumbCircleBorderColorDisabled);
|
||||
sliderTrackStyle.Add(SliderTrack.MarkBorderBrushProperty, SliderResourceKey.ThumbCircleBorderColorDisabled);
|
||||
sliderTrackStyle.Add(SliderTrack.TrackBarBrushProperty, SliderTokenResourceKey.TrackBgDisabled);
|
||||
sliderTrackStyle.Add(SliderTrack.MarkBorderActiveBrushProperty, SliderTokenResourceKey.ThumbCircleBorderColorDisabled);
|
||||
sliderTrackStyle.Add(SliderTrack.MarkBorderBrushProperty, SliderTokenResourceKey.ThumbCircleBorderColorDisabled);
|
||||
disabledStyle.Add(sliderTrackStyle);
|
||||
var thumbStyle = new Style(selector => selector.Nesting().Template().OfType<SliderThumb>());
|
||||
thumbStyle.Add(SliderThumb.BorderBrushProperty, SliderResourceKey.ThumbCircleBorderColorDisabled);
|
||||
thumbStyle.Add(SliderThumb.BorderBrushProperty, SliderTokenResourceKey.ThumbCircleBorderColorDisabled);
|
||||
disabledStyle.Add(thumbStyle);
|
||||
sliderStyle.Add(disabledStyle);
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public class SliderThumb : TemplatedControl
|
||||
{
|
||||
var transitions = new Transitions();
|
||||
transitions.Add(AnimationUtils.CreateTransition<SolidColorBrushTransition>(OutlineBrushProperty));
|
||||
transitions.Add(AnimationUtils.CreateTransition<ThicknessTransition>(OutlineThicknessProperty, GlobalResourceKey.MotionDurationFast));
|
||||
transitions.Add(AnimationUtils.CreateTransition<ThicknessTransition>(OutlineThicknessProperty, GlobalTokenResourceKey.MotionDurationFast));
|
||||
transitions.Add(AnimationUtils.CreateTransition<SolidColorBrushTransition>(BorderBrushProperty));
|
||||
Transitions = transitions;
|
||||
}
|
||||
|
@ -16,22 +16,22 @@ internal class SliderThumbTheme : BaseControlTheme
|
||||
{
|
||||
var commonStyle = new Style(selector => selector.Nesting());
|
||||
commonStyle.Add(SliderThumb.FocusableProperty, true);
|
||||
commonStyle.Add(SliderThumb.BackgroundProperty, GlobalResourceKey.ColorBgContainer);
|
||||
commonStyle.Add(SliderThumb.BorderThicknessProperty, SliderResourceKey.ThumbCircleBorderThickness);
|
||||
commonStyle.Add(SliderThumb.BorderBrushProperty, SliderResourceKey.ThumbCircleBorderColor);
|
||||
commonStyle.Add(SliderThumb.OutlineBrushProperty, SliderResourceKey.ThumbOutlineColor);
|
||||
commonStyle.Add(SliderThumb.BackgroundProperty, GlobalTokenResourceKey.ColorBgContainer);
|
||||
commonStyle.Add(SliderThumb.BorderThicknessProperty, SliderTokenResourceKey.ThumbCircleBorderThickness);
|
||||
commonStyle.Add(SliderThumb.BorderBrushProperty, SliderTokenResourceKey.ThumbCircleBorderColor);
|
||||
commonStyle.Add(SliderThumb.OutlineBrushProperty, SliderTokenResourceKey.ThumbOutlineColor);
|
||||
commonStyle.Add(SliderThumb.OutlineThicknessProperty, new Thickness(0));
|
||||
commonStyle.Add(SliderThumb.ThumbCircleSizeProperty, SliderResourceKey.ThumbCircleSize);
|
||||
commonStyle.Add(SliderThumb.WidthProperty, SliderResourceKey.ThumbSize);
|
||||
commonStyle.Add(SliderThumb.HeightProperty, SliderResourceKey.ThumbSize);
|
||||
commonStyle.Add(SliderThumb.ThumbCircleSizeProperty, SliderTokenResourceKey.ThumbCircleSize);
|
||||
commonStyle.Add(SliderThumb.WidthProperty, SliderTokenResourceKey.ThumbSize);
|
||||
commonStyle.Add(SliderThumb.HeightProperty, SliderTokenResourceKey.ThumbSize);
|
||||
commonStyle.Add(SliderThumb.ZIndexProperty, SliderThumb.NormalZIndex);
|
||||
|
||||
var hoverOrFocusStyle = new Style(selector => Selectors.Or(selector.Nesting().Class(StdPseudoClass.PointerOver),
|
||||
selector.Nesting().Class(StdPseudoClass.Focus)));
|
||||
hoverOrFocusStyle.Add(SliderThumb.BorderThicknessProperty, SliderResourceKey.ThumbCircleBorderThicknessHover);
|
||||
hoverOrFocusStyle.Add(SliderThumb.BorderBrushProperty, SliderResourceKey.ThumbCircleBorderActiveColor);
|
||||
hoverOrFocusStyle.Add(SliderThumb.ThumbCircleSizeProperty, SliderResourceKey.ThumbCircleSizeHover);
|
||||
hoverOrFocusStyle.Add(SliderThumb.OutlineThicknessProperty, SliderResourceKey.ThumbOutlineThickness);
|
||||
hoverOrFocusStyle.Add(SliderThumb.BorderThicknessProperty, SliderTokenResourceKey.ThumbCircleBorderThicknessHover);
|
||||
hoverOrFocusStyle.Add(SliderThumb.BorderBrushProperty, SliderTokenResourceKey.ThumbCircleBorderActiveColor);
|
||||
hoverOrFocusStyle.Add(SliderThumb.ThumbCircleSizeProperty, SliderTokenResourceKey.ThumbCircleSizeHover);
|
||||
hoverOrFocusStyle.Add(SliderThumb.OutlineThicknessProperty, SliderTokenResourceKey.ThumbOutlineThickness);
|
||||
commonStyle.Add(hoverOrFocusStyle);
|
||||
|
||||
var focusStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Focus));
|
||||
|
@ -345,11 +345,11 @@ public class SliderTrack : Control, IControlCustomStyle
|
||||
public override void ApplyTemplate()
|
||||
{
|
||||
base.ApplyTemplate();
|
||||
TokenResourceBinder.CreateTokenBinding(this, SliderTrack.SliderTrackSizeProperty, SliderResourceKey.SliderTrackSize);
|
||||
TokenResourceBinder.CreateTokenBinding(this, SliderTrack.SliderMarkSizeProperty, SliderResourceKey.MarkSize);
|
||||
TokenResourceBinder.CreateTokenBinding(this, SliderTrack.SliderRailSizeProperty, SliderResourceKey.RailSize);
|
||||
TokenResourceBinder.CreateTokenBinding(this, SliderTrack.MarkBackgroundBrushProperty, GlobalResourceKey.ColorBgElevated);
|
||||
TokenResourceBinder.CreateTokenBinding(this, SliderTrack.MarkBorderThicknessProperty, SliderResourceKey.ThumbCircleBorderThickness);
|
||||
TokenResourceBinder.CreateTokenBinding(this, SliderTrack.SliderTrackSizeProperty, SliderTokenResourceKey.SliderTrackSize);
|
||||
TokenResourceBinder.CreateTokenBinding(this, SliderTrack.SliderMarkSizeProperty, SliderTokenResourceKey.MarkSize);
|
||||
TokenResourceBinder.CreateTokenBinding(this, SliderTrack.SliderRailSizeProperty, SliderTokenResourceKey.RailSize);
|
||||
TokenResourceBinder.CreateTokenBinding(this, SliderTrack.MarkBackgroundBrushProperty, GlobalTokenResourceKey.ColorBgElevated);
|
||||
TokenResourceBinder.CreateTokenBinding(this, SliderTrack.MarkBorderThicknessProperty, SliderTokenResourceKey.ThumbCircleBorderThickness);
|
||||
|
||||
HandleRangeModeChanged();
|
||||
CalculateMaxMarkSize();
|
||||
|
@ -213,7 +213,7 @@ internal class SwitchKnob : Control, IControlCustomStyle
|
||||
|
||||
void IControlCustomStyle.SetupTokenBindings()
|
||||
{
|
||||
TokenResourceBinder.CreateTokenBinding(this, LoadingBgOpacityTokenProperty, ToggleSwitchResourceKey.SwitchDisabledOpacity);
|
||||
TokenResourceBinder.CreateTokenBinding(this, LoadingBgOpacityTokenProperty, ToggleSwitchTokenResourceKey.SwitchDisabledOpacity);
|
||||
LoadingAnimationDuration = TimeSpan.FromMilliseconds(1200);
|
||||
}
|
||||
|
||||
|
@ -40,17 +40,17 @@ public class ToggleSwitchTheme : BaseControlTheme
|
||||
|
||||
protected override void BuildStyles()
|
||||
{
|
||||
this.Add(ToggleSwitch.ForegroundProperty, GlobalResourceKey.ColorTextLightSolid);
|
||||
this.Add(ToggleSwitch.TrackPaddingProperty, ToggleSwitchResourceKey.TrackPadding);
|
||||
this.Add(ToggleSwitch.ForegroundProperty, GlobalTokenResourceKey.ColorTextLightSolid);
|
||||
this.Add(ToggleSwitch.TrackPaddingProperty, ToggleSwitchTokenResourceKey.TrackPadding);
|
||||
BuildSizeTypeStyle();
|
||||
BuildEnabledStyle();
|
||||
|
||||
var disabledStyle = new Style(selector => selector.Nesting().PropertyEquals(ToggleSwitch.IsEnabledProperty, false));
|
||||
disabledStyle.Add(ToggleSwitch.SwitchOpacityProperty, ToggleSwitchResourceKey.SwitchDisabledOpacity);
|
||||
disabledStyle.Add(ToggleSwitch.SwitchOpacityProperty, ToggleSwitchTokenResourceKey.SwitchDisabledOpacity);
|
||||
Add(disabledStyle);
|
||||
|
||||
var loadingStyle = new Style(selector => selector.Nesting().PropertyEquals(ToggleSwitch.IsLoadingProperty, true));
|
||||
loadingStyle.Add(ToggleSwitch.SwitchOpacityProperty, ToggleSwitchResourceKey.SwitchDisabledOpacity);
|
||||
loadingStyle.Add(ToggleSwitch.SwitchOpacityProperty, ToggleSwitchTokenResourceKey.SwitchDisabledOpacity);
|
||||
Add(loadingStyle);
|
||||
}
|
||||
|
||||
@ -59,19 +59,19 @@ public class ToggleSwitchTheme : BaseControlTheme
|
||||
var enabledStyle = new Style(selector => selector.Nesting());
|
||||
enabledStyle.Add(ToggleSwitch.SwitchOpacityProperty, 1d);
|
||||
var checkedStyle = new Style(selector => selector.Nesting().PropertyEquals(ToggleSwitch.IsCheckedProperty, true));
|
||||
checkedStyle.Add(ToggleSwitch.GrooveBackgroundProperty, ToggleSwitchResourceKey.SwitchColor);
|
||||
checkedStyle.Add(ToggleSwitch.GrooveBackgroundProperty, ToggleSwitchTokenResourceKey.SwitchColor);
|
||||
{
|
||||
var hoverStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver));
|
||||
hoverStyle.Add(ToggleSwitch.GrooveBackgroundProperty, GlobalResourceKey.ColorPrimaryHover);
|
||||
hoverStyle.Add(ToggleSwitch.GrooveBackgroundProperty, GlobalTokenResourceKey.ColorPrimaryHover);
|
||||
checkedStyle.Add(hoverStyle);
|
||||
}
|
||||
enabledStyle.Add(checkedStyle);
|
||||
|
||||
var unCheckedStyle = new Style(selector => selector.Nesting().PropertyEquals(ToggleSwitch.IsCheckedProperty, false));
|
||||
unCheckedStyle.Add(ToggleSwitch.GrooveBackgroundProperty, GlobalResourceKey.ColorTextQuaternary);
|
||||
unCheckedStyle.Add(ToggleSwitch.GrooveBackgroundProperty, GlobalTokenResourceKey.ColorTextQuaternary);
|
||||
{
|
||||
var hoverStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver));
|
||||
hoverStyle.Add(ToggleSwitch.GrooveBackgroundProperty, GlobalResourceKey.ColorTextTertiary);
|
||||
hoverStyle.Add(ToggleSwitch.GrooveBackgroundProperty, GlobalTokenResourceKey.ColorTextTertiary);
|
||||
unCheckedStyle.Add(hoverStyle);
|
||||
}
|
||||
enabledStyle.Add(unCheckedStyle);
|
||||
@ -81,59 +81,59 @@ public class ToggleSwitchTheme : BaseControlTheme
|
||||
private void BuildSizeTypeStyle()
|
||||
{
|
||||
var smallSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(ToggleSwitch.SizeTypeProperty, SizeType.Small));
|
||||
smallSizeStyle.Add(ToggleSwitch.FontSizeProperty, ToggleSwitchResourceKey.ExtraInfoFontSizeSM);
|
||||
smallSizeStyle.Add(ToggleSwitch.FontSizeProperty, ToggleSwitchTokenResourceKey.ExtraInfoFontSizeSM);
|
||||
{
|
||||
var knobSizeStyle = new Style(selector => selector.Nesting().Template().OfType<SwitchKnob>());
|
||||
knobSizeStyle.Add(SwitchKnob.KnobSizeProperty, ToggleSwitchResourceKey.HandleSizeSM);
|
||||
knobSizeStyle.Add(SwitchKnob.OriginKnobSizeProperty, ToggleSwitchResourceKey.HandleSizeSM);
|
||||
knobSizeStyle.Add(SwitchKnob.KnobSizeProperty, ToggleSwitchTokenResourceKey.HandleSizeSM);
|
||||
knobSizeStyle.Add(SwitchKnob.OriginKnobSizeProperty, ToggleSwitchTokenResourceKey.HandleSizeSM);
|
||||
smallSizeStyle.Add(knobSizeStyle);
|
||||
}
|
||||
smallSizeStyle.Add(ToggleSwitch.InnerMaxMarginProperty, ToggleSwitchResourceKey.InnerMaxMarginSM);
|
||||
smallSizeStyle.Add(ToggleSwitch.InnerMinMarginProperty, ToggleSwitchResourceKey.InnerMinMarginSM);
|
||||
smallSizeStyle.Add(ToggleSwitch.TrackHeightProperty, ToggleSwitchResourceKey.TrackHeightSM);
|
||||
smallSizeStyle.Add(ToggleSwitch.TrackMinWidthProperty, ToggleSwitchResourceKey.TrackMinWidthSM);
|
||||
smallSizeStyle.Add(ToggleSwitch.IconSizeProperty, ToggleSwitchResourceKey.IconSizeSM);
|
||||
smallSizeStyle.Add(ToggleSwitch.InnerMaxMarginProperty, ToggleSwitchTokenResourceKey.InnerMaxMarginSM);
|
||||
smallSizeStyle.Add(ToggleSwitch.InnerMinMarginProperty, ToggleSwitchTokenResourceKey.InnerMinMarginSM);
|
||||
smallSizeStyle.Add(ToggleSwitch.TrackHeightProperty, ToggleSwitchTokenResourceKey.TrackHeightSM);
|
||||
smallSizeStyle.Add(ToggleSwitch.TrackMinWidthProperty, ToggleSwitchTokenResourceKey.TrackMinWidthSM);
|
||||
smallSizeStyle.Add(ToggleSwitch.IconSizeProperty, ToggleSwitchTokenResourceKey.IconSizeSM);
|
||||
|
||||
Add(smallSizeStyle);
|
||||
|
||||
var middleSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(ToggleSwitch.SizeTypeProperty, SizeType.Middle));
|
||||
middleSizeStyle.Add(ToggleSwitch.FontSizeProperty, ToggleSwitchResourceKey.ExtraInfoFontSize);
|
||||
middleSizeStyle.Add(ToggleSwitch.FontSizeProperty, ToggleSwitchTokenResourceKey.ExtraInfoFontSize);
|
||||
{
|
||||
var knobSizeStyle = new Style(selector => selector.Nesting().Template().OfType<SwitchKnob>());
|
||||
knobSizeStyle.Add(SwitchKnob.KnobSizeProperty, ToggleSwitchResourceKey.HandleSize);
|
||||
knobSizeStyle.Add(SwitchKnob.OriginKnobSizeProperty, ToggleSwitchResourceKey.HandleSize);
|
||||
knobSizeStyle.Add(SwitchKnob.KnobSizeProperty, ToggleSwitchTokenResourceKey.HandleSize);
|
||||
knobSizeStyle.Add(SwitchKnob.OriginKnobSizeProperty, ToggleSwitchTokenResourceKey.HandleSize);
|
||||
middleSizeStyle.Add(knobSizeStyle);
|
||||
}
|
||||
middleSizeStyle.Add(ToggleSwitch.InnerMaxMarginProperty, ToggleSwitchResourceKey.InnerMaxMargin);
|
||||
middleSizeStyle.Add(ToggleSwitch.InnerMinMarginProperty, ToggleSwitchResourceKey.InnerMinMargin);
|
||||
middleSizeStyle.Add(ToggleSwitch.TrackHeightProperty, ToggleSwitchResourceKey.TrackHeight);
|
||||
middleSizeStyle.Add(ToggleSwitch.TrackMinWidthProperty, ToggleSwitchResourceKey.TrackMinWidth);
|
||||
middleSizeStyle.Add(ToggleSwitch.IconSizeProperty, ToggleSwitchResourceKey.IconSize);
|
||||
middleSizeStyle.Add(ToggleSwitch.InnerMaxMarginProperty, ToggleSwitchTokenResourceKey.InnerMaxMargin);
|
||||
middleSizeStyle.Add(ToggleSwitch.InnerMinMarginProperty, ToggleSwitchTokenResourceKey.InnerMinMargin);
|
||||
middleSizeStyle.Add(ToggleSwitch.TrackHeightProperty, ToggleSwitchTokenResourceKey.TrackHeight);
|
||||
middleSizeStyle.Add(ToggleSwitch.TrackMinWidthProperty, ToggleSwitchTokenResourceKey.TrackMinWidth);
|
||||
middleSizeStyle.Add(ToggleSwitch.IconSizeProperty, ToggleSwitchTokenResourceKey.IconSize);
|
||||
Add(middleSizeStyle);
|
||||
|
||||
var largeSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(ToggleSwitch.SizeTypeProperty, SizeType.Large));
|
||||
largeSizeStyle.Add(ToggleSwitch.FontSizeProperty, ToggleSwitchResourceKey.ExtraInfoFontSize);
|
||||
largeSizeStyle.Add(ToggleSwitch.FontSizeProperty, ToggleSwitchTokenResourceKey.ExtraInfoFontSize);
|
||||
{
|
||||
var knobSizeStyle = new Style(selector => selector.Nesting().Template().OfType<SwitchKnob>());
|
||||
knobSizeStyle.Add(SwitchKnob.KnobSizeProperty, ToggleSwitchResourceKey.HandleSize);
|
||||
knobSizeStyle.Add(SwitchKnob.OriginKnobSizeProperty, ToggleSwitchResourceKey.HandleSize);
|
||||
knobSizeStyle.Add(SwitchKnob.KnobSizeProperty, ToggleSwitchTokenResourceKey.HandleSize);
|
||||
knobSizeStyle.Add(SwitchKnob.OriginKnobSizeProperty, ToggleSwitchTokenResourceKey.HandleSize);
|
||||
largeSizeStyle.Add(knobSizeStyle);
|
||||
}
|
||||
largeSizeStyle.Add(ToggleSwitch.InnerMaxMarginProperty, ToggleSwitchResourceKey.InnerMaxMargin);
|
||||
largeSizeStyle.Add(ToggleSwitch.InnerMinMarginProperty, ToggleSwitchResourceKey.InnerMinMargin);
|
||||
largeSizeStyle.Add(ToggleSwitch.TrackHeightProperty, ToggleSwitchResourceKey.TrackHeight);
|
||||
largeSizeStyle.Add(ToggleSwitch.TrackMinWidthProperty, ToggleSwitchResourceKey.TrackMinWidth);
|
||||
largeSizeStyle.Add(ToggleSwitch.IconSizeProperty, ToggleSwitchResourceKey.IconSize);
|
||||
largeSizeStyle.Add(ToggleSwitch.InnerMaxMarginProperty, ToggleSwitchTokenResourceKey.InnerMaxMargin);
|
||||
largeSizeStyle.Add(ToggleSwitch.InnerMinMarginProperty, ToggleSwitchTokenResourceKey.InnerMinMargin);
|
||||
largeSizeStyle.Add(ToggleSwitch.TrackHeightProperty, ToggleSwitchTokenResourceKey.TrackHeight);
|
||||
largeSizeStyle.Add(ToggleSwitch.TrackMinWidthProperty, ToggleSwitchTokenResourceKey.TrackMinWidth);
|
||||
largeSizeStyle.Add(ToggleSwitch.IconSizeProperty, ToggleSwitchTokenResourceKey.IconSize);
|
||||
Add(largeSizeStyle);
|
||||
|
||||
{
|
||||
var switchKnobStyle = new Style(selector => selector.Nesting().Template().OfType<SwitchKnob>());
|
||||
switchKnobStyle.Add(SwitchKnob.KnobBackgroundColorProperty, ToggleSwitchResourceKey.HandleBg);
|
||||
switchKnobStyle.Add(SwitchKnob.KnobBoxShadowProperty, ToggleSwitchResourceKey.HandleShadow);
|
||||
switchKnobStyle.Add(SwitchKnob.LoadIndicatorBrushProperty, GlobalResourceKey.ColorTextQuaternary);
|
||||
switchKnobStyle.Add(SwitchKnob.KnobBackgroundColorProperty, ToggleSwitchTokenResourceKey.HandleBg);
|
||||
switchKnobStyle.Add(SwitchKnob.KnobBoxShadowProperty, ToggleSwitchTokenResourceKey.HandleShadow);
|
||||
switchKnobStyle.Add(SwitchKnob.LoadIndicatorBrushProperty, GlobalTokenResourceKey.ColorTextQuaternary);
|
||||
var checkedStyle =
|
||||
new Style(selector => selector.Nesting().PropertyEquals(SwitchKnob.IsCheckedStateProperty, true));
|
||||
checkedStyle.Add(SwitchKnob.LoadIndicatorBrushProperty, ToggleSwitchResourceKey.SwitchColor);
|
||||
checkedStyle.Add(SwitchKnob.LoadIndicatorBrushProperty, ToggleSwitchTokenResourceKey.SwitchColor);
|
||||
switchKnobStyle.Add(checkedStyle);
|
||||
Add(switchKnobStyle);
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ internal class BaseOverflowMenuItemTheme : BaseControlTheme
|
||||
};
|
||||
|
||||
Grid.SetColumn(itemTextPresenter, 0);
|
||||
TokenResourceBinder.CreateTokenBinding(itemTextPresenter, ContentPresenter.MarginProperty, MenuResourceKey.ItemMargin);
|
||||
TokenResourceBinder.CreateTokenBinding(itemTextPresenter, ContentPresenter.MarginProperty, MenuTokenResourceKey.ItemMargin);
|
||||
CreateTemplateParentBinding(itemTextPresenter, ContentPresenter.ContentProperty, BaseOverflowMenuItem.HeaderProperty);
|
||||
CreateTemplateParentBinding(itemTextPresenter, ContentPresenter.ContentTemplateProperty, BaseOverflowMenuItem.HeaderTemplateProperty);
|
||||
|
||||
@ -83,11 +83,11 @@ internal class BaseOverflowMenuItemTheme : BaseControlTheme
|
||||
|
||||
|
||||
CreateTemplateParentBinding(closeButton, IconButton.IsVisibleProperty, BaseOverflowMenuItem.IsClosableProperty);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(menuCloseIcon, PathIcon.NormalFilledBrushProperty, GlobalResourceKey.ColorIcon);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(menuCloseIcon, PathIcon.ActiveFilledBrushProperty, GlobalResourceKey.ColorIconHover);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(menuCloseIcon, PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorIcon);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(menuCloseIcon, PathIcon.ActiveFilledBrushProperty, GlobalTokenResourceKey.ColorIconHover);
|
||||
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(menuCloseIcon, PathIcon.WidthProperty, GlobalResourceKey.IconSizeSM);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(menuCloseIcon, PathIcon.HeightProperty, GlobalResourceKey.IconSizeSM);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(menuCloseIcon, PathIcon.WidthProperty, GlobalTokenResourceKey.IconSizeSM);
|
||||
TokenResourceBinder.CreateGlobalTokenBinding(menuCloseIcon, PathIcon.HeightProperty, GlobalTokenResourceKey.IconSizeSM);
|
||||
|
||||
Grid.SetColumn(menuCloseIcon, 4);
|
||||
closeButton.RegisterInNameScope(scope);
|
||||
@ -110,22 +110,22 @@ internal class BaseOverflowMenuItemTheme : BaseControlTheme
|
||||
|
||||
private void BuildCommonStyle(Style commonStyle)
|
||||
{
|
||||
commonStyle.Add(BaseOverflowMenuItem.ForegroundProperty, MenuResourceKey.ItemColor);
|
||||
commonStyle.Add(BaseOverflowMenuItem.ForegroundProperty, MenuTokenResourceKey.ItemColor);
|
||||
{
|
||||
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(BaseOverflowMenuItem.ForegroundProperty, MenuResourceKey.ItemHoverColor);
|
||||
hoverStyle.Add(BaseOverflowMenuItem.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);
|
||||
@ -134,7 +134,7 @@ internal class BaseOverflowMenuItemTheme : BaseControlTheme
|
||||
private void BuildDisabledStyle()
|
||||
{
|
||||
var disabledStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Disabled));
|
||||
disabledStyle.Add(BaseOverflowMenuItem.ForegroundProperty, MenuResourceKey.ItemDisabledColor);
|
||||
disabledStyle.Add(BaseOverflowMenuItem.ForegroundProperty, MenuTokenResourceKey.ItemDisabledColor);
|
||||
Add(disabledStyle);
|
||||
}
|
||||
|
||||
|
@ -95,11 +95,11 @@ public class BaseTabControl : AvaloniaTabControl
|
||||
private void SetupBorderBinding()
|
||||
{
|
||||
if (_frameDecorator is not null) {
|
||||
TokenResourceBinder.CreateTokenBinding(this, BorderThicknessProperty, GlobalResourceKey.BorderThickness, BindingPriority.Template,
|
||||
TokenResourceBinder.CreateTokenBinding(this, BorderThicknessProperty, GlobalTokenResourceKey.BorderThickness, BindingPriority.Template,
|
||||
new RenderScaleAwareThicknessConfigure(this));
|
||||
}
|
||||
|
||||
TokenResourceBinder.CreateTokenBinding(this, TabAndContentGutterProperty, TabControlResourceKey.TabAndContentGutter);
|
||||
TokenResourceBinder.CreateTokenBinding(this, TabAndContentGutterProperty, TabControlTokenResourceKey.TabAndContentGutter);
|
||||
}
|
||||
|
||||
protected override void PrepareContainerForItemOverride(Control container, object? item, int index)
|
||||
|
@ -63,7 +63,7 @@ internal class BaseTabControlTheme : BaseControlTheme
|
||||
{
|
||||
base.BuildStyles();
|
||||
var commonStyle = new Style(selector => selector.Nesting());
|
||||
commonStyle.Add(BaseTabControl.BorderBrushProperty, GlobalResourceKey.ColorBorderSecondary);
|
||||
commonStyle.Add(BaseTabControl.BorderBrushProperty, GlobalTokenResourceKey.ColorBorderSecondary);
|
||||
|
||||
// 设置 items presenter 是否居中
|
||||
// 分为上、右、下、左
|
||||
|
@ -58,7 +58,7 @@ internal class BaseTabItemTheme : BaseControlTheme
|
||||
Name = ItemCloseButtonPart
|
||||
};
|
||||
iconButton.RegisterInNameScope(scope);
|
||||
TokenResourceBinder.CreateTokenBinding(iconButton, IconButton.MarginProperty, TabControlResourceKey.CloseIconMargin);
|
||||
TokenResourceBinder.CreateTokenBinding(iconButton, IconButton.MarginProperty, TabControlTokenResourceKey.CloseIconMargin);
|
||||
|
||||
CreateTemplateParentBinding(iconButton, IconButton.IconProperty, TabItem.CloseIconProperty);
|
||||
CreateTemplateParentBinding(iconButton, IconButton.IsVisibleProperty, TabItem.IsClosableProperty);
|
||||
@ -71,18 +71,18 @@ internal class BaseTabItemTheme : BaseControlTheme
|
||||
{
|
||||
var commonStyle = new Style(selector => selector.Nesting());
|
||||
commonStyle.Add(TabItem.CursorProperty, new Cursor(StandardCursorType.Hand));
|
||||
commonStyle.Add(TabItem.ForegroundProperty, TabControlResourceKey.ItemColor);
|
||||
commonStyle.Add(TabItem.ForegroundProperty, TabControlTokenResourceKey.ItemColor);
|
||||
|
||||
// Icon 一些通用属性
|
||||
{
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().Name(ItemIconPart));
|
||||
iconStyle.Add(PathIcon.MarginProperty, TabControlResourceKey.ItemIconMargin);
|
||||
iconStyle.Add(PathIcon.MarginProperty, TabControlTokenResourceKey.ItemIconMargin);
|
||||
commonStyle.Add(iconStyle);
|
||||
}
|
||||
|
||||
// hover
|
||||
var hoverStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver));
|
||||
hoverStyle.Add(TabItem.ForegroundProperty, TabControlResourceKey.ItemHoverColor);
|
||||
hoverStyle.Add(TabItem.ForegroundProperty, TabControlTokenResourceKey.ItemHoverColor);
|
||||
{
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().Name(ItemIconPart));
|
||||
iconStyle.Add(PathIcon.IconModeProperty, IconMode.Active);
|
||||
@ -93,7 +93,7 @@ internal class BaseTabItemTheme : BaseControlTheme
|
||||
|
||||
// 选中
|
||||
var selectedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Selected));
|
||||
selectedStyle.Add(TabItem.ForegroundProperty, TabControlResourceKey.ItemSelectedColor);
|
||||
selectedStyle.Add(TabItem.ForegroundProperty, TabControlTokenResourceKey.ItemSelectedColor);
|
||||
{
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().Name(ItemIconPart));
|
||||
iconStyle.Add(PathIcon.IconModeProperty, IconMode.Selected);
|
||||
@ -110,12 +110,12 @@ internal class BaseTabItemTheme : BaseControlTheme
|
||||
{
|
||||
var largeSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(TabItem.SizeTypeProperty, SizeType.Large));
|
||||
|
||||
largeSizeStyle.Add(TabItem.FontSizeProperty, TabControlResourceKey.TitleFontSizeLG);
|
||||
largeSizeStyle.Add(TabItem.FontSizeProperty, TabControlTokenResourceKey.TitleFontSizeLG);
|
||||
{
|
||||
// Icon
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().Name(ItemIconPart));
|
||||
iconStyle.Add(PathIcon.WidthProperty, GlobalResourceKey.IconSize);
|
||||
iconStyle.Add(PathIcon.HeightProperty, GlobalResourceKey.IconSize);
|
||||
iconStyle.Add(PathIcon.WidthProperty, GlobalTokenResourceKey.IconSize);
|
||||
iconStyle.Add(PathIcon.HeightProperty, GlobalTokenResourceKey.IconSize);
|
||||
largeSizeStyle.Add(iconStyle);
|
||||
}
|
||||
|
||||
@ -125,11 +125,11 @@ internal class BaseTabItemTheme : BaseControlTheme
|
||||
{
|
||||
// Icon
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().Name(ItemIconPart));
|
||||
iconStyle.Add(PathIcon.WidthProperty, GlobalResourceKey.IconSize);
|
||||
iconStyle.Add(PathIcon.HeightProperty, GlobalResourceKey.IconSize);
|
||||
iconStyle.Add(PathIcon.WidthProperty, GlobalTokenResourceKey.IconSize);
|
||||
iconStyle.Add(PathIcon.HeightProperty, GlobalTokenResourceKey.IconSize);
|
||||
middleSizeStyle.Add(iconStyle);
|
||||
}
|
||||
middleSizeStyle.Add(TabItem.FontSizeProperty, TabControlResourceKey.TitleFontSize);
|
||||
middleSizeStyle.Add(TabItem.FontSizeProperty, TabControlTokenResourceKey.TitleFontSize);
|
||||
Add(middleSizeStyle);
|
||||
|
||||
var smallSizeType = new Style(selector => selector.Nesting().PropertyEquals(TabItem.SizeTypeProperty, SizeType.Small));
|
||||
@ -137,12 +137,12 @@ internal class BaseTabItemTheme : BaseControlTheme
|
||||
{
|
||||
// Icon
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().Name(ItemIconPart));
|
||||
iconStyle.Add(PathIcon.WidthProperty, GlobalResourceKey.IconSizeSM);
|
||||
iconStyle.Add(PathIcon.HeightProperty, GlobalResourceKey.IconSizeSM);
|
||||
iconStyle.Add(PathIcon.WidthProperty, GlobalTokenResourceKey.IconSizeSM);
|
||||
iconStyle.Add(PathIcon.HeightProperty, GlobalTokenResourceKey.IconSizeSM);
|
||||
smallSizeType.Add(iconStyle);
|
||||
}
|
||||
|
||||
smallSizeType.Add(TabItem.FontSizeProperty, TabControlResourceKey.TitleFontSizeSM);
|
||||
smallSizeType.Add(TabItem.FontSizeProperty, TabControlTokenResourceKey.TitleFontSizeSM);
|
||||
Add(smallSizeType);
|
||||
}
|
||||
|
||||
@ -191,7 +191,7 @@ internal class BaseTabItemTheme : BaseControlTheme
|
||||
private void BuildDisabledStyle()
|
||||
{
|
||||
var disabledStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Disabled));
|
||||
disabledStyle.Add(TabItem.ForegroundProperty, GlobalResourceKey.ColorTextDisabled);
|
||||
disabledStyle.Add(TabItem.ForegroundProperty, GlobalTokenResourceKey.ColorTextDisabled);
|
||||
Add(disabledStyle);
|
||||
}
|
||||
}
|
@ -177,8 +177,8 @@ internal abstract class BaseTabScrollViewer : ScrollViewer
|
||||
_startEdgeIndicator = e.NameScope.Find<Border>(BaseTabScrollViewerTheme.ScrollStartEdgeIndicatorPart);
|
||||
_endEdgeIndicator = e.NameScope.Find<Border>(BaseTabScrollViewerTheme.ScrollEndEdgeIndicatorPart);
|
||||
|
||||
TokenResourceBinder.CreateTokenBinding(this, EdgeShadowStartColorProperty, GlobalResourceKey.ColorFillSecondary);
|
||||
TokenResourceBinder.CreateTokenBinding(this, MenuEdgeThicknessProperty, TabControlResourceKey.MenuEdgeThickness);
|
||||
TokenResourceBinder.CreateTokenBinding(this, EdgeShadowStartColorProperty, GlobalTokenResourceKey.ColorFillSecondary);
|
||||
TokenResourceBinder.CreateTokenBinding(this, MenuEdgeThicknessProperty, TabControlTokenResourceKey.MenuEdgeThickness);
|
||||
|
||||
SetupIndicatorsVisibility();
|
||||
}
|
||||
|
@ -47,9 +47,9 @@ internal class BaseTabScrollViewerTheme : BaseControlTheme
|
||||
VerticalAlignment = VerticalAlignment.Center
|
||||
};
|
||||
|
||||
TokenResourceBinder.CreateTokenBinding(menuIndicatorIcon, PathIcon.WidthProperty, GlobalResourceKey.IconSize);
|
||||
TokenResourceBinder.CreateTokenBinding(menuIndicatorIcon, PathIcon.HeightProperty, GlobalResourceKey.IconSize);
|
||||
TokenResourceBinder.CreateTokenBinding(menuIndicatorIcon, PathIcon.NormalFilledBrushProperty, GlobalResourceKey.ColorTextSecondary);
|
||||
TokenResourceBinder.CreateTokenBinding(menuIndicatorIcon, PathIcon.WidthProperty, GlobalTokenResourceKey.IconSize);
|
||||
TokenResourceBinder.CreateTokenBinding(menuIndicatorIcon, PathIcon.HeightProperty, GlobalTokenResourceKey.IconSize);
|
||||
TokenResourceBinder.CreateTokenBinding(menuIndicatorIcon, PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorTextSecondary);
|
||||
|
||||
var menuIndicator = new IconButton()
|
||||
{
|
||||
@ -129,16 +129,16 @@ internal class BaseTabScrollViewerTheme : BaseControlTheme
|
||||
var menuIndicatorStyle =
|
||||
new Style(selector => selector.Nesting().Template().Name(ScrollMenuIndicatorPart));
|
||||
menuIndicatorStyle.Add(DockPanel.DockProperty, Dock.Right);
|
||||
menuIndicatorStyle.Add(TemplatedControl.PaddingProperty, TabControlResourceKey.MenuIndicatorPaddingHorizontal);
|
||||
menuIndicatorStyle.Add(TemplatedControl.PaddingProperty, TabControlTokenResourceKey.MenuIndicatorPaddingHorizontal);
|
||||
|
||||
var startEdgeIndicatorStyle = new Style(selector => selector.Nesting().Template().Name(ScrollStartEdgeIndicatorPart));
|
||||
startEdgeIndicatorStyle.Add(Layoutable.WidthProperty, TabControlResourceKey.MenuEdgeThickness);
|
||||
startEdgeIndicatorStyle.Add(Layoutable.WidthProperty, TabControlTokenResourceKey.MenuEdgeThickness);
|
||||
startEdgeIndicatorStyle.Add(Border.HorizontalAlignmentProperty, HorizontalAlignment.Left);
|
||||
startEdgeIndicatorStyle.Add(Border.VerticalAlignmentProperty, VerticalAlignment.Stretch);
|
||||
topPlacementStyle.Add(startEdgeIndicatorStyle);
|
||||
|
||||
var endEdgeIndicatorStyle = new Style(selector => selector.Nesting().Template().Name(ScrollEndEdgeIndicatorPart));
|
||||
endEdgeIndicatorStyle.Add(Layoutable.WidthProperty, TabControlResourceKey.MenuEdgeThickness);
|
||||
endEdgeIndicatorStyle.Add(Layoutable.WidthProperty, TabControlTokenResourceKey.MenuEdgeThickness);
|
||||
endEdgeIndicatorStyle.Add(Border.HorizontalAlignmentProperty, HorizontalAlignment.Right);
|
||||
endEdgeIndicatorStyle.Add(Border.VerticalAlignmentProperty, VerticalAlignment.Stretch);
|
||||
|
||||
@ -159,16 +159,16 @@ internal class BaseTabScrollViewerTheme : BaseControlTheme
|
||||
var menuIndicatorStyle =
|
||||
new Style(selector => selector.Nesting().Template().Name(ScrollMenuIndicatorPart));
|
||||
menuIndicatorStyle.Add(DockPanel.DockProperty, Dock.Bottom);
|
||||
menuIndicatorStyle.Add(TemplatedControl.PaddingProperty, TabControlResourceKey.MenuIndicatorPaddingVertical);
|
||||
menuIndicatorStyle.Add(TemplatedControl.PaddingProperty, TabControlTokenResourceKey.MenuIndicatorPaddingVertical);
|
||||
|
||||
var startEdgeIndicatorStyle = new Style(selector => selector.Nesting().Template().Name(ScrollStartEdgeIndicatorPart));
|
||||
startEdgeIndicatorStyle.Add(Layoutable.HeightProperty, TabControlResourceKey.MenuEdgeThickness);
|
||||
startEdgeIndicatorStyle.Add(Layoutable.HeightProperty, TabControlTokenResourceKey.MenuEdgeThickness);
|
||||
startEdgeIndicatorStyle.Add(Border.HorizontalAlignmentProperty, HorizontalAlignment.Stretch);
|
||||
startEdgeIndicatorStyle.Add(Border.VerticalAlignmentProperty, VerticalAlignment.Top);
|
||||
rightPlacementStyle.Add(startEdgeIndicatorStyle);
|
||||
|
||||
var endEdgeIndicatorStyle = new Style(selector => selector.Nesting().Template().Name(ScrollEndEdgeIndicatorPart));
|
||||
endEdgeIndicatorStyle.Add(Layoutable.HeightProperty, TabControlResourceKey.MenuEdgeThickness);
|
||||
endEdgeIndicatorStyle.Add(Layoutable.HeightProperty, TabControlTokenResourceKey.MenuEdgeThickness);
|
||||
endEdgeIndicatorStyle.Add(Border.HorizontalAlignmentProperty, HorizontalAlignment.Stretch);
|
||||
endEdgeIndicatorStyle.Add(Border.VerticalAlignmentProperty, VerticalAlignment.Bottom);
|
||||
rightPlacementStyle.Add(endEdgeIndicatorStyle);
|
||||
@ -188,16 +188,16 @@ internal class BaseTabScrollViewerTheme : BaseControlTheme
|
||||
var menuIndicatorStyle =
|
||||
new Style(selector => selector.Nesting().Template().Name(ScrollMenuIndicatorPart));
|
||||
menuIndicatorStyle.Add(DockPanel.DockProperty, Dock.Right);
|
||||
menuIndicatorStyle.Add(TemplatedControl.PaddingProperty, TabControlResourceKey.MenuIndicatorPaddingHorizontal);
|
||||
menuIndicatorStyle.Add(TemplatedControl.PaddingProperty, TabControlTokenResourceKey.MenuIndicatorPaddingHorizontal);
|
||||
|
||||
var startEdgeIndicatorStyle = new Style(selector => selector.Nesting().Template().Name(ScrollStartEdgeIndicatorPart));
|
||||
startEdgeIndicatorStyle.Add(Layoutable.WidthProperty, TabControlResourceKey.MenuEdgeThickness);
|
||||
startEdgeIndicatorStyle.Add(Layoutable.WidthProperty, TabControlTokenResourceKey.MenuEdgeThickness);
|
||||
startEdgeIndicatorStyle.Add(Border.HorizontalAlignmentProperty, HorizontalAlignment.Left);
|
||||
startEdgeIndicatorStyle.Add(Border.VerticalAlignmentProperty, VerticalAlignment.Stretch);
|
||||
bottomPlacementStyle.Add(startEdgeIndicatorStyle);
|
||||
|
||||
var endEdgeIndicatorStyle = new Style(selector => selector.Nesting().Template().Name(ScrollEndEdgeIndicatorPart));
|
||||
endEdgeIndicatorStyle.Add(Layoutable.WidthProperty, TabControlResourceKey.MenuEdgeThickness);
|
||||
endEdgeIndicatorStyle.Add(Layoutable.WidthProperty, TabControlTokenResourceKey.MenuEdgeThickness);
|
||||
endEdgeIndicatorStyle.Add(Border.HorizontalAlignmentProperty, HorizontalAlignment.Right);
|
||||
endEdgeIndicatorStyle.Add(Border.VerticalAlignmentProperty, VerticalAlignment.Stretch);
|
||||
bottomPlacementStyle.Add(endEdgeIndicatorStyle);
|
||||
@ -217,16 +217,16 @@ internal class BaseTabScrollViewerTheme : BaseControlTheme
|
||||
var menuIndicatorStyle =
|
||||
new Style(selector => selector.Nesting().Template().Name(ScrollMenuIndicatorPart));
|
||||
menuIndicatorStyle.Add(DockPanel.DockProperty, Dock.Bottom);
|
||||
menuIndicatorStyle.Add(TemplatedControl.PaddingProperty, TabControlResourceKey.MenuIndicatorPaddingVertical);
|
||||
menuIndicatorStyle.Add(TemplatedControl.PaddingProperty, TabControlTokenResourceKey.MenuIndicatorPaddingVertical);
|
||||
|
||||
var startEdgeIndicatorStyle = new Style(selector => selector.Nesting().Template().Name(ScrollStartEdgeIndicatorPart));
|
||||
startEdgeIndicatorStyle.Add(Layoutable.HeightProperty, TabControlResourceKey.MenuEdgeThickness);
|
||||
startEdgeIndicatorStyle.Add(Layoutable.HeightProperty, TabControlTokenResourceKey.MenuEdgeThickness);
|
||||
startEdgeIndicatorStyle.Add(Border.HorizontalAlignmentProperty, HorizontalAlignment.Stretch);
|
||||
startEdgeIndicatorStyle.Add(Border.VerticalAlignmentProperty, VerticalAlignment.Top);
|
||||
leftPlacementStyle.Add(startEdgeIndicatorStyle);
|
||||
|
||||
var endEdgeIndicatorStyle = new Style(selector => selector.Nesting().Template().Name(ScrollEndEdgeIndicatorPart));
|
||||
endEdgeIndicatorStyle.Add(Layoutable.HeightProperty, TabControlResourceKey.MenuEdgeThickness);
|
||||
endEdgeIndicatorStyle.Add(Layoutable.HeightProperty, TabControlTokenResourceKey.MenuEdgeThickness);
|
||||
endEdgeIndicatorStyle.Add(Border.HorizontalAlignmentProperty, HorizontalAlignment.Stretch);
|
||||
endEdgeIndicatorStyle.Add(Border.VerticalAlignmentProperty, VerticalAlignment.Bottom);
|
||||
leftPlacementStyle.Add(endEdgeIndicatorStyle);
|
||||
|
@ -113,9 +113,9 @@ public class CardTabControl : BaseTabControl, IControlCustomStyle
|
||||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||
{
|
||||
base.OnApplyTemplate(e);
|
||||
TokenResourceBinder.CreateTokenBinding(this, CardBorderThicknessProperty, GlobalResourceKey.BorderThickness, BindingPriority.Template,
|
||||
TokenResourceBinder.CreateTokenBinding(this, CardBorderThicknessProperty, GlobalTokenResourceKey.BorderThickness, BindingPriority.Template,
|
||||
new RenderScaleAwareThicknessConfigure(this));
|
||||
TokenResourceBinder.CreateTokenBinding(this, CardSizeProperty, TabControlResourceKey.CardSize);
|
||||
TokenResourceBinder.CreateTokenBinding(this, CardSizeProperty, TabControlTokenResourceKey.CardSize);
|
||||
_customStyle.HandleTemplateApplied(e.NameScope);
|
||||
}
|
||||
|
||||
@ -150,11 +150,11 @@ public class CardTabControl : BaseTabControl, IControlCustomStyle
|
||||
private void HandleSizeTypeChanged()
|
||||
{
|
||||
if (SizeType == SizeType.Large) {
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(this, CardBorderRadiusSizeProperty, GlobalResourceKey.BorderRadiusLG);
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(this, CardBorderRadiusSizeProperty, GlobalTokenResourceKey.BorderRadiusLG);
|
||||
} else if (SizeType == SizeType.Middle) {
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(this, CardBorderRadiusSizeProperty, GlobalResourceKey.BorderRadius);
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(this, CardBorderRadiusSizeProperty, GlobalTokenResourceKey.BorderRadius);
|
||||
} else {
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(this, CardBorderRadiusSizeProperty, GlobalResourceKey.BorderRadiusSM);
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(this, CardBorderRadiusSizeProperty, GlobalTokenResourceKey.BorderRadiusSM);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,12 +49,12 @@ internal class CardTabControlTheme : BaseTabControlTheme
|
||||
Kind = "PlusOutlined"
|
||||
};
|
||||
|
||||
TokenResourceBinder.CreateTokenBinding(addTabIcon, PathIcon.NormalFilledBrushProperty, TabControlResourceKey.ItemColor);
|
||||
TokenResourceBinder.CreateTokenBinding(addTabIcon, PathIcon.ActiveFilledBrushProperty, TabControlResourceKey.ItemHoverColor);
|
||||
TokenResourceBinder.CreateTokenBinding(addTabIcon, PathIcon.DisabledFilledBrushProperty, GlobalResourceKey.ColorTextDisabled);
|
||||
TokenResourceBinder.CreateTokenBinding(addTabIcon, PathIcon.NormalFilledBrushProperty, TabControlTokenResourceKey.ItemColor);
|
||||
TokenResourceBinder.CreateTokenBinding(addTabIcon, PathIcon.ActiveFilledBrushProperty, TabControlTokenResourceKey.ItemHoverColor);
|
||||
TokenResourceBinder.CreateTokenBinding(addTabIcon, PathIcon.DisabledFilledBrushProperty, GlobalTokenResourceKey.ColorTextDisabled);
|
||||
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(addTabIcon, PathIcon.WidthProperty, GlobalResourceKey.IconSize);
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(addTabIcon, PathIcon.HeightProperty, GlobalResourceKey.IconSize);
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(addTabIcon, PathIcon.WidthProperty, GlobalTokenResourceKey.IconSize);
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(addTabIcon, PathIcon.HeightProperty, GlobalTokenResourceKey.IconSize);
|
||||
|
||||
var addTabButton = new IconButton
|
||||
{
|
||||
@ -68,7 +68,7 @@ internal class CardTabControlTheme : BaseTabControlTheme
|
||||
CreateTemplateParentBinding(addTabButton, IconButton.CornerRadiusProperty, CardTabControl.CardBorderRadiusProperty);
|
||||
CreateTemplateParentBinding(addTabButton, IconButton.IsVisibleProperty, CardTabControl.IsShowAddTabButtonProperty);
|
||||
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(addTabButton, IconButton.BorderBrushProperty, GlobalResourceKey.ColorBorderSecondary);
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(addTabButton, IconButton.BorderBrushProperty, GlobalTokenResourceKey.ColorBorderSecondary);
|
||||
|
||||
addTabButton.RegisterInNameScope(scope);
|
||||
|
||||
@ -107,10 +107,10 @@ internal class CardTabControlTheme : BaseTabControlTheme
|
||||
|
||||
var itemPresenterPanelStyle = new Style(selector => selector.Nesting().Template().Name(ItemsPresenterPart).Child().OfType<StackPanel>());
|
||||
itemPresenterPanelStyle.Add(StackPanel.OrientationProperty, Orientation.Horizontal);
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlResourceKey.CardGutter);
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlTokenResourceKey.CardGutter);
|
||||
|
||||
var addTabButtonStyle = new Style(selector => selector.Nesting().Template().Name(AddTabButtonPart));
|
||||
addTabButtonStyle.Add(IconButton.MarginProperty, TabControlResourceKey.AddTabButtonMarginHorizontal);
|
||||
addTabButtonStyle.Add(IconButton.MarginProperty, TabControlTokenResourceKey.AddTabButtonMarginHorizontal);
|
||||
topStyle.Add(addTabButtonStyle);
|
||||
|
||||
topStyle.Add(itemPresenterPanelStyle);
|
||||
@ -127,11 +127,11 @@ internal class CardTabControlTheme : BaseTabControlTheme
|
||||
|
||||
var itemPresenterPanelStyle = new Style(selector => selector.Nesting().Template().Name(ItemsPresenterPart).Child().OfType<StackPanel>());
|
||||
itemPresenterPanelStyle.Add(StackPanel.OrientationProperty, Orientation.Vertical);
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlResourceKey.CardGutter);
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlTokenResourceKey.CardGutter);
|
||||
rightStyle.Add(itemPresenterPanelStyle);
|
||||
|
||||
var addTabButtonStyle = new Style(selector => selector.Nesting().Template().Name(AddTabButtonPart));
|
||||
addTabButtonStyle.Add(IconButton.MarginProperty, TabControlResourceKey.AddTabButtonMarginVertical);
|
||||
addTabButtonStyle.Add(IconButton.MarginProperty, TabControlTokenResourceKey.AddTabButtonMarginVertical);
|
||||
rightStyle.Add(addTabButtonStyle);
|
||||
|
||||
commonStyle.Add(rightStyle);
|
||||
@ -146,11 +146,11 @@ internal class CardTabControlTheme : BaseTabControlTheme
|
||||
|
||||
var itemPresenterPanelStyle = new Style(selector => selector.Nesting().Template().Name(ItemsPresenterPart).Child().OfType<StackPanel>());
|
||||
itemPresenterPanelStyle.Add(StackPanel.OrientationProperty, Orientation.Horizontal);
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlResourceKey.CardGutter);
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlTokenResourceKey.CardGutter);
|
||||
bottomStyle.Add(itemPresenterPanelStyle);
|
||||
|
||||
var addTabButtonStyle = new Style(selector => selector.Nesting().Template().Name(AddTabButtonPart));
|
||||
addTabButtonStyle.Add(IconButton.MarginProperty, TabControlResourceKey.AddTabButtonMarginHorizontal);
|
||||
addTabButtonStyle.Add(IconButton.MarginProperty, TabControlTokenResourceKey.AddTabButtonMarginHorizontal);
|
||||
bottomStyle.Add(addTabButtonStyle);
|
||||
|
||||
commonStyle.Add(bottomStyle);
|
||||
@ -165,11 +165,11 @@ internal class CardTabControlTheme : BaseTabControlTheme
|
||||
|
||||
var itemPresenterPanelStyle = new Style(selector => selector.Nesting().Template().Name(ItemsPresenterPart).Child().OfType<StackPanel>());
|
||||
itemPresenterPanelStyle.Add(StackPanel.OrientationProperty, Orientation.Vertical);
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlResourceKey.CardGutter);
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlTokenResourceKey.CardGutter);
|
||||
leftStyle.Add(itemPresenterPanelStyle);
|
||||
|
||||
var addTabButtonStyle = new Style(selector => selector.Nesting().Template().Name(AddTabButtonPart));
|
||||
addTabButtonStyle.Add(IconButton.MarginProperty, TabControlResourceKey.AddTabButtonMarginVertical);
|
||||
addTabButtonStyle.Add(IconButton.MarginProperty, TabControlTokenResourceKey.AddTabButtonMarginVertical);
|
||||
leftStyle.Add(addTabButtonStyle);
|
||||
|
||||
commonStyle.Add(leftStyle);
|
||||
|
@ -41,9 +41,9 @@ internal class CardTabItemTheme : BaseTabItemTheme
|
||||
|
||||
{
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.MarginProperty, TabControlResourceKey.HorizontalItemMargin);
|
||||
decoratorStyle.Add(Border.BackgroundProperty, TabControlResourceKey.CardBg);
|
||||
decoratorStyle.Add(Border.BorderBrushProperty, GlobalResourceKey.ColorBorderSecondary);
|
||||
decoratorStyle.Add(Border.MarginProperty, TabControlTokenResourceKey.HorizontalItemMargin);
|
||||
decoratorStyle.Add(Border.BackgroundProperty, TabControlTokenResourceKey.CardBg);
|
||||
decoratorStyle.Add(Border.BorderBrushProperty, GlobalTokenResourceKey.ColorBorderSecondary);
|
||||
commonStyle.Add(decoratorStyle);
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ internal class CardTabItemTheme : BaseTabItemTheme
|
||||
var selectedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Selected));
|
||||
{
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.BackgroundProperty, GlobalResourceKey.ColorBgContainer);
|
||||
decoratorStyle.Add(Border.BackgroundProperty, GlobalTokenResourceKey.ColorBgContainer);
|
||||
selectedStyle.Add(decoratorStyle);
|
||||
}
|
||||
commonStyle.Add(selectedStyle);
|
||||
@ -71,7 +71,7 @@ internal class CardTabItemTheme : BaseTabItemTheme
|
||||
var largeSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(TabItem.SizeTypeProperty, SizeType.Large));
|
||||
{
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlResourceKey.CardPaddingLG);
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlTokenResourceKey.CardPaddingLG);
|
||||
largeSizeStyle.Add(decoratorStyle);
|
||||
}
|
||||
topOrBottomStyle.Add(largeSizeStyle);
|
||||
@ -79,7 +79,7 @@ internal class CardTabItemTheme : BaseTabItemTheme
|
||||
var middleSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(TabItem.SizeTypeProperty, SizeType.Middle));
|
||||
{
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlResourceKey.CardPadding);
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlTokenResourceKey.CardPadding);
|
||||
middleSizeStyle.Add(decoratorStyle);
|
||||
}
|
||||
topOrBottomStyle.Add(middleSizeStyle);
|
||||
@ -87,7 +87,7 @@ internal class CardTabItemTheme : BaseTabItemTheme
|
||||
var smallSizeType = new Style(selector => selector.Nesting().PropertyEquals(TabItem.SizeTypeProperty, SizeType.Small));
|
||||
{
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlResourceKey.CardPaddingSM);
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlTokenResourceKey.CardPaddingSM);
|
||||
smallSizeType.Add(decoratorStyle);
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ internal class CardTabItemTheme : BaseTabItemTheme
|
||||
var largeSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(TabItem.SizeTypeProperty, SizeType.Large));
|
||||
{
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlResourceKey.VerticalItemPadding);
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlTokenResourceKey.VerticalItemPadding);
|
||||
largeSizeStyle.Add(decoratorStyle);
|
||||
}
|
||||
leftOrRightStyle.Add(largeSizeStyle);
|
||||
@ -109,7 +109,7 @@ internal class CardTabItemTheme : BaseTabItemTheme
|
||||
var middleSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(TabItem.SizeTypeProperty, SizeType.Middle));
|
||||
{
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlResourceKey.VerticalItemPadding);
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlTokenResourceKey.VerticalItemPadding);
|
||||
middleSizeStyle.Add(decoratorStyle);
|
||||
}
|
||||
leftOrRightStyle.Add(middleSizeStyle);
|
||||
@ -117,7 +117,7 @@ internal class CardTabItemTheme : BaseTabItemTheme
|
||||
var smallSizeType = new Style(selector => selector.Nesting().PropertyEquals(TabItem.SizeTypeProperty, SizeType.Small));
|
||||
{
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlResourceKey.VerticalItemPadding);
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlTokenResourceKey.VerticalItemPadding);
|
||||
smallSizeType.Add(decoratorStyle);
|
||||
}
|
||||
|
||||
@ -138,7 +138,7 @@ internal class CardTabItemTheme : BaseTabItemTheme
|
||||
topStyle.Add(iconStyle);
|
||||
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.BorderBrushProperty, GlobalResourceKey.ColorBorderSecondary);
|
||||
decoratorStyle.Add(Border.BorderBrushProperty, GlobalTokenResourceKey.ColorBorderSecondary);
|
||||
|
||||
Add(topStyle);
|
||||
}
|
||||
@ -174,7 +174,7 @@ internal class CardTabItemTheme : BaseTabItemTheme
|
||||
{
|
||||
var disabledStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Disabled));
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.BackgroundProperty, GlobalResourceKey.ColorBgContainerDisabled);
|
||||
decoratorStyle.Add(Border.BackgroundProperty, GlobalTokenResourceKey.ColorBgContainerDisabled);
|
||||
disabledStyle.Add(decoratorStyle);
|
||||
Add(disabledStyle);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public class TabControl : BaseTabControl
|
||||
if (_selectedIndicator.Transitions is null) {
|
||||
var transitions = new Transitions();
|
||||
transitions.Add(AnimationUtils.CreateTransition<TransformOperationsTransition>(Border.RenderTransformProperty,
|
||||
GlobalResourceKey.MotionDurationSlow, new ExponentialEaseOut()));
|
||||
GlobalTokenResourceKey.MotionDurationSlow, new ExponentialEaseOut()));
|
||||
_selectedIndicator.Transitions = transitions;
|
||||
// 只需要执行一次
|
||||
LayoutUpdated -= HandleLayoutUpdated;
|
||||
@ -119,6 +119,6 @@ public class TabControl : BaseTabControl
|
||||
_selectedIndicator = e.NameScope.Find<Border>(TabControlTheme.SelectedItemIndicatorPart);
|
||||
_itemsPresenter = e.NameScope.Find<ItemsPresenter>(TabControlTheme.ItemsPresenterPart);
|
||||
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(this, SelectedIndicatorThicknessProperty, GlobalResourceKey.LineWidthBold);
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(this, SelectedIndicatorThicknessProperty, GlobalTokenResourceKey.LineWidthBold);
|
||||
}
|
||||
}
|
@ -53,7 +53,7 @@ internal class TabControlTheme : BaseTabControlTheme
|
||||
Name = SelectedItemIndicatorPart,
|
||||
};
|
||||
border.RegisterInNameScope(scope);
|
||||
TokenResourceBinder.CreateTokenBinding(border, Border.BackgroundProperty, TabControlResourceKey.InkBarColor);
|
||||
TokenResourceBinder.CreateTokenBinding(border, Border.BackgroundProperty, TabControlTokenResourceKey.InkBarColor);
|
||||
|
||||
layout.Children.Add(itemsPresenter);
|
||||
layout.Children.Add(border);
|
||||
@ -73,7 +73,7 @@ internal class TabControlTheme : BaseTabControlTheme
|
||||
var topStyle = new Style(selector => selector.Nesting().Class(BaseTabControl.TopPC));
|
||||
|
||||
var itemPresenterPanelStyle = new Style(selector => selector.Nesting().Template().Name(ItemsPresenterPart).Child().OfType<StackPanel>());
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlResourceKey.HorizontalItemGutter);
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlTokenResourceKey.HorizontalItemGutter);
|
||||
itemPresenterPanelStyle.Add(StackPanel.OrientationProperty, Orientation.Horizontal);
|
||||
|
||||
topStyle.Add(itemPresenterPanelStyle);
|
||||
@ -93,7 +93,7 @@ internal class TabControlTheme : BaseTabControlTheme
|
||||
|
||||
var itemPresenterPanelStyle = new Style(selector => selector.Nesting().Template().Name(ItemsPresenterPart).Child().OfType<StackPanel>());
|
||||
itemPresenterPanelStyle.Add(StackPanel.OrientationProperty, Orientation.Vertical);
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlResourceKey.VerticalItemGutter);
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlTokenResourceKey.VerticalItemGutter);
|
||||
rightStyle.Add(itemPresenterPanelStyle);
|
||||
|
||||
var indicatorStyle = new Style(selector => selector.Nesting().Template().Name(SelectedItemIndicatorPart));
|
||||
@ -108,7 +108,7 @@ internal class TabControlTheme : BaseTabControlTheme
|
||||
var bottomStyle = new Style(selector => selector.Nesting().Class(BaseTabControl.BottomPC));
|
||||
|
||||
var itemPresenterPanelStyle = new Style(selector => selector.Nesting().Template().Name(ItemsPresenterPart).Child().OfType<StackPanel>());
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlResourceKey.HorizontalItemGutter);
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlTokenResourceKey.HorizontalItemGutter);
|
||||
itemPresenterPanelStyle.Add(StackPanel.OrientationProperty, Orientation.Horizontal);
|
||||
bottomStyle.Add(itemPresenterPanelStyle);
|
||||
|
||||
@ -125,7 +125,7 @@ internal class TabControlTheme : BaseTabControlTheme
|
||||
|
||||
var itemPresenterPanelStyle = new Style(selector => selector.Nesting().Template().Name(ItemsPresenterPart).Child().OfType<StackPanel>());
|
||||
itemPresenterPanelStyle.Add(StackPanel.OrientationProperty, Orientation.Vertical);
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlResourceKey.VerticalItemGutter);
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlTokenResourceKey.VerticalItemGutter);
|
||||
leftStyle.Add(itemPresenterPanelStyle);
|
||||
|
||||
var indicatorStyle = new Style(selector => selector.Nesting().Template().Name(SelectedItemIndicatorPart));
|
||||
|
@ -84,10 +84,10 @@ public class TabItem : AvaloniaTabItem, IControlCustomStyle, ICustomHitTest
|
||||
UIStructureUtils.SetTemplateParent(Icon, this);
|
||||
Icon.Name = BaseTabItemTheme.ItemIconPart;
|
||||
if (Icon.ThemeType != IconThemeType.TwoTone) {
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.NormalFilledBrushProperty, TabControlResourceKey.ItemColor);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.ActiveFilledBrushProperty, TabControlResourceKey.ItemHoverColor);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.SelectedFilledBrushProperty, TabControlResourceKey.ItemSelectedColor);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.DisabledFilledBrushProperty, GlobalResourceKey.ColorTextDisabled);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.NormalFilledBrushProperty, TabControlTokenResourceKey.ItemColor);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.ActiveFilledBrushProperty, TabControlTokenResourceKey.ItemHoverColor);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.SelectedFilledBrushProperty, TabControlTokenResourceKey.ItemSelectedColor);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.DisabledFilledBrushProperty, GlobalTokenResourceKey.ColorTextDisabled);
|
||||
}
|
||||
if (_contentLayout is not null) {
|
||||
_contentLayout.Children.Insert(0, Icon);
|
||||
@ -102,17 +102,17 @@ public class TabItem : AvaloniaTabItem, IControlCustomStyle, ICustomHitTest
|
||||
{
|
||||
Kind = "CloseOutlined"
|
||||
};
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(CloseIcon, PathIcon.WidthProperty, GlobalResourceKey.IconSizeSM);
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(CloseIcon, PathIcon.HeightProperty, GlobalResourceKey.IconSizeSM);
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(CloseIcon, PathIcon.WidthProperty, GlobalTokenResourceKey.IconSizeSM);
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(CloseIcon, PathIcon.HeightProperty, GlobalTokenResourceKey.IconSizeSM);
|
||||
}
|
||||
|
||||
CloseIcon.SetValue(PathIcon.VerticalAlignmentProperty, VerticalAlignment.Center);
|
||||
|
||||
UIStructureUtils.SetTemplateParent(CloseIcon, this);
|
||||
if (CloseIcon.ThemeType != IconThemeType.TwoTone) {
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.NormalFilledBrushProperty, GlobalResourceKey.ColorIcon);
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.ActiveFilledBrushProperty, GlobalResourceKey.ColorIconHover);
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.DisabledFilledBrushProperty, GlobalResourceKey.ColorTextDisabled);
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorIcon);
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.ActiveFilledBrushProperty, GlobalTokenResourceKey.ColorIconHover);
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.DisabledFilledBrushProperty, GlobalTokenResourceKey.ColorTextDisabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,12 +28,12 @@ internal class TabItemTheme : BaseTabItemTheme
|
||||
selector.Nesting().PropertyEquals(TabItem.TabStripPlacementProperty, Dock.Bottom)));
|
||||
|
||||
{
|
||||
topOrBottomStyle.Add(Border.MarginProperty, TabControlResourceKey.HorizontalItemMargin);
|
||||
topOrBottomStyle.Add(Border.MarginProperty, TabControlTokenResourceKey.HorizontalItemMargin);
|
||||
|
||||
var largeSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(TabItem.SizeTypeProperty, SizeType.Large));
|
||||
{
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlResourceKey.HorizontalItemPaddingLG);
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlTokenResourceKey.HorizontalItemPaddingLG);
|
||||
largeSizeStyle.Add(decoratorStyle);
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ internal class TabItemTheme : BaseTabItemTheme
|
||||
var middleSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(TabItem.SizeTypeProperty, SizeType.Middle));
|
||||
{
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlResourceKey.HorizontalItemPadding);
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlTokenResourceKey.HorizontalItemPadding);
|
||||
middleSizeStyle.Add(decoratorStyle);
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ internal class TabItemTheme : BaseTabItemTheme
|
||||
var smallSizeType = new Style(selector => selector.Nesting().PropertyEquals(TabItem.SizeTypeProperty, SizeType.Small));
|
||||
{
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlResourceKey.HorizontalItemPaddingSM);
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlTokenResourceKey.HorizontalItemPaddingSM);
|
||||
smallSizeType.Add(decoratorStyle);
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ internal class TabItemTheme : BaseTabItemTheme
|
||||
var largeSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(TabItem.SizeTypeProperty, SizeType.Large));
|
||||
{
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlResourceKey.VerticalItemPadding);
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlTokenResourceKey.VerticalItemPadding);
|
||||
largeSizeStyle.Add(decoratorStyle);
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ internal class TabItemTheme : BaseTabItemTheme
|
||||
var middleSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(TabItem.SizeTypeProperty, SizeType.Middle));
|
||||
{
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlResourceKey.VerticalItemPadding);
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlTokenResourceKey.VerticalItemPadding);
|
||||
middleSizeStyle.Add(decoratorStyle);
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ internal class TabItemTheme : BaseTabItemTheme
|
||||
var smallSizeType = new Style(selector => selector.Nesting().PropertyEquals(TabItem.SizeTypeProperty, SizeType.Small));
|
||||
{
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlResourceKey.VerticalItemPadding);
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlTokenResourceKey.VerticalItemPadding);
|
||||
smallSizeType.Add(decoratorStyle);
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ public abstract class BaseTabStrip : AvaloniaTabStrip, ISizeTypeAware
|
||||
private void SetupBorderBinding()
|
||||
{
|
||||
if (_frameDecorator is not null) {
|
||||
TokenResourceBinder.CreateTokenBinding(this, BorderThicknessProperty, GlobalResourceKey.BorderThickness, BindingPriority.Template,
|
||||
TokenResourceBinder.CreateTokenBinding(this, BorderThicknessProperty, GlobalTokenResourceKey.BorderThickness, BindingPriority.Template,
|
||||
new RenderScaleAwareThicknessConfigure(this));
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ internal class BaseTabStripItemTheme : BaseControlTheme
|
||||
Name = ItemCloseButtonPart
|
||||
};
|
||||
iconButton.RegisterInNameScope(scope);
|
||||
TokenResourceBinder.CreateTokenBinding(iconButton, IconButton.MarginProperty, TabControlResourceKey.CloseIconMargin);
|
||||
TokenResourceBinder.CreateTokenBinding(iconButton, IconButton.MarginProperty, TabControlTokenResourceKey.CloseIconMargin);
|
||||
|
||||
CreateTemplateParentBinding(iconButton, IconButton.IconProperty, TabStripItem.CloseIconProperty);
|
||||
CreateTemplateParentBinding(iconButton, IconButton.IsVisibleProperty, TabStripItem.IsClosableProperty);
|
||||
@ -71,18 +71,18 @@ internal class BaseTabStripItemTheme : BaseControlTheme
|
||||
{
|
||||
var commonStyle = new Style(selector => selector.Nesting());
|
||||
commonStyle.Add(TabStripItem.CursorProperty, new Cursor(StandardCursorType.Hand));
|
||||
commonStyle.Add(TabStripItem.ForegroundProperty, TabControlResourceKey.ItemColor);
|
||||
commonStyle.Add(TabStripItem.ForegroundProperty, TabControlTokenResourceKey.ItemColor);
|
||||
|
||||
// Icon 一些通用属性
|
||||
{
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().Name(ItemIconPart));
|
||||
iconStyle.Add(PathIcon.MarginProperty, TabControlResourceKey.ItemIconMargin);
|
||||
iconStyle.Add(PathIcon.MarginProperty, TabControlTokenResourceKey.ItemIconMargin);
|
||||
commonStyle.Add(iconStyle);
|
||||
}
|
||||
|
||||
// hover
|
||||
var hoverStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver));
|
||||
hoverStyle.Add(TabStripItem.ForegroundProperty, TabControlResourceKey.ItemHoverColor);
|
||||
hoverStyle.Add(TabStripItem.ForegroundProperty, TabControlTokenResourceKey.ItemHoverColor);
|
||||
{
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().Name(ItemIconPart));
|
||||
iconStyle.Add(PathIcon.IconModeProperty, IconMode.Active);
|
||||
@ -93,7 +93,7 @@ internal class BaseTabStripItemTheme : BaseControlTheme
|
||||
|
||||
// 选中
|
||||
var selectedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Selected));
|
||||
selectedStyle.Add(TabStripItem.ForegroundProperty, TabControlResourceKey.ItemSelectedColor);
|
||||
selectedStyle.Add(TabStripItem.ForegroundProperty, TabControlTokenResourceKey.ItemSelectedColor);
|
||||
{
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().Name(ItemIconPart));
|
||||
iconStyle.Add(PathIcon.IconModeProperty, IconMode.Selected);
|
||||
@ -110,12 +110,12 @@ internal class BaseTabStripItemTheme : BaseControlTheme
|
||||
{
|
||||
var largeSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(TabStripItem.SizeTypeProperty, SizeType.Large));
|
||||
|
||||
largeSizeStyle.Add(TabStripItem.FontSizeProperty, TabControlResourceKey.TitleFontSizeLG);
|
||||
largeSizeStyle.Add(TabStripItem.FontSizeProperty, TabControlTokenResourceKey.TitleFontSizeLG);
|
||||
{
|
||||
// Icon
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().Name(ItemIconPart));
|
||||
iconStyle.Add(PathIcon.WidthProperty, GlobalResourceKey.IconSize);
|
||||
iconStyle.Add(PathIcon.HeightProperty, GlobalResourceKey.IconSize);
|
||||
iconStyle.Add(PathIcon.WidthProperty, GlobalTokenResourceKey.IconSize);
|
||||
iconStyle.Add(PathIcon.HeightProperty, GlobalTokenResourceKey.IconSize);
|
||||
largeSizeStyle.Add(iconStyle);
|
||||
}
|
||||
|
||||
@ -125,11 +125,11 @@ internal class BaseTabStripItemTheme : BaseControlTheme
|
||||
{
|
||||
// Icon
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().Name(ItemIconPart));
|
||||
iconStyle.Add(PathIcon.WidthProperty, GlobalResourceKey.IconSize);
|
||||
iconStyle.Add(PathIcon.HeightProperty, GlobalResourceKey.IconSize);
|
||||
iconStyle.Add(PathIcon.WidthProperty, GlobalTokenResourceKey.IconSize);
|
||||
iconStyle.Add(PathIcon.HeightProperty, GlobalTokenResourceKey.IconSize);
|
||||
middleSizeStyle.Add(iconStyle);
|
||||
}
|
||||
middleSizeStyle.Add(TabStripItem.FontSizeProperty, TabControlResourceKey.TitleFontSize);
|
||||
middleSizeStyle.Add(TabStripItem.FontSizeProperty, TabControlTokenResourceKey.TitleFontSize);
|
||||
Add(middleSizeStyle);
|
||||
|
||||
var smallSizeType = new Style(selector => selector.Nesting().PropertyEquals(TabStripItem.SizeTypeProperty, SizeType.Small));
|
||||
@ -137,12 +137,12 @@ internal class BaseTabStripItemTheme : BaseControlTheme
|
||||
{
|
||||
// Icon
|
||||
var iconStyle = new Style(selector => selector.Nesting().Template().Name(ItemIconPart));
|
||||
iconStyle.Add(PathIcon.WidthProperty, GlobalResourceKey.IconSizeSM);
|
||||
iconStyle.Add(PathIcon.HeightProperty, GlobalResourceKey.IconSizeSM);
|
||||
iconStyle.Add(PathIcon.WidthProperty, GlobalTokenResourceKey.IconSizeSM);
|
||||
iconStyle.Add(PathIcon.HeightProperty, GlobalTokenResourceKey.IconSizeSM);
|
||||
smallSizeType.Add(iconStyle);
|
||||
}
|
||||
|
||||
smallSizeType.Add(TabStripItem.FontSizeProperty, TabControlResourceKey.TitleFontSizeSM);
|
||||
smallSizeType.Add(TabStripItem.FontSizeProperty, TabControlTokenResourceKey.TitleFontSizeSM);
|
||||
Add(smallSizeType);
|
||||
}
|
||||
|
||||
@ -191,7 +191,7 @@ internal class BaseTabStripItemTheme : BaseControlTheme
|
||||
private void BuildDisabledStyle()
|
||||
{
|
||||
var disabledStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Disabled));
|
||||
disabledStyle.Add(TabStripItem.ForegroundProperty, GlobalResourceKey.ColorTextDisabled);
|
||||
disabledStyle.Add(TabStripItem.ForegroundProperty, GlobalTokenResourceKey.ColorTextDisabled);
|
||||
Add(disabledStyle);
|
||||
}
|
||||
}
|
@ -39,7 +39,7 @@ internal class BaseTabStripTheme : BaseControlTheme
|
||||
{
|
||||
base.BuildStyles();
|
||||
var commonStyle = new Style(selector => selector.Nesting());
|
||||
commonStyle.Add(BaseTabStrip.BorderBrushProperty, GlobalResourceKey.ColorBorderSecondary);
|
||||
commonStyle.Add(BaseTabStrip.BorderBrushProperty, GlobalTokenResourceKey.ColorBorderSecondary);
|
||||
|
||||
// 设置 items presenter 是否居中
|
||||
// 分为上、右、下、左
|
||||
|
@ -115,9 +115,9 @@ public class CardTabStrip : BaseTabStrip, IControlCustomStyle
|
||||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||
{
|
||||
base.OnApplyTemplate(e);
|
||||
TokenResourceBinder.CreateTokenBinding(this, CardBorderThicknessProperty, GlobalResourceKey.BorderThickness, BindingPriority.Template,
|
||||
TokenResourceBinder.CreateTokenBinding(this, CardBorderThicknessProperty, GlobalTokenResourceKey.BorderThickness, BindingPriority.Template,
|
||||
new RenderScaleAwareThicknessConfigure(this));
|
||||
TokenResourceBinder.CreateTokenBinding(this, CardSizeProperty, TabControlResourceKey.CardSize);
|
||||
TokenResourceBinder.CreateTokenBinding(this, CardSizeProperty, TabControlTokenResourceKey.CardSize);
|
||||
_customStyle.HandleTemplateApplied(e.NameScope);
|
||||
}
|
||||
|
||||
@ -154,11 +154,11 @@ public class CardTabStrip : BaseTabStrip, IControlCustomStyle
|
||||
private void HandleSizeTypeChanged()
|
||||
{
|
||||
if (SizeType == SizeType.Large) {
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(this, CardBorderRadiusSizeProperty, GlobalResourceKey.BorderRadiusLG);
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(this, CardBorderRadiusSizeProperty, GlobalTokenResourceKey.BorderRadiusLG);
|
||||
} else if (SizeType == SizeType.Middle) {
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(this, CardBorderRadiusSizeProperty, GlobalResourceKey.BorderRadius);
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(this, CardBorderRadiusSizeProperty, GlobalTokenResourceKey.BorderRadius);
|
||||
} else {
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(this, CardBorderRadiusSizeProperty, GlobalResourceKey.BorderRadiusSM);
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(this, CardBorderRadiusSizeProperty, GlobalTokenResourceKey.BorderRadiusSM);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,9 +41,9 @@ internal class CardTabStripItemTheme : BaseTabStripItemTheme
|
||||
|
||||
{
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.MarginProperty, TabControlResourceKey.HorizontalItemMargin);
|
||||
decoratorStyle.Add(Border.BackgroundProperty, TabControlResourceKey.CardBg);
|
||||
decoratorStyle.Add(Border.BorderBrushProperty, GlobalResourceKey.ColorBorderSecondary);
|
||||
decoratorStyle.Add(Border.MarginProperty, TabControlTokenResourceKey.HorizontalItemMargin);
|
||||
decoratorStyle.Add(Border.BackgroundProperty, TabControlTokenResourceKey.CardBg);
|
||||
decoratorStyle.Add(Border.BorderBrushProperty, GlobalTokenResourceKey.ColorBorderSecondary);
|
||||
commonStyle.Add(decoratorStyle);
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ internal class CardTabStripItemTheme : BaseTabStripItemTheme
|
||||
var selectedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Selected));
|
||||
{
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.BackgroundProperty, GlobalResourceKey.ColorBgContainer);
|
||||
decoratorStyle.Add(Border.BackgroundProperty, GlobalTokenResourceKey.ColorBgContainer);
|
||||
selectedStyle.Add(decoratorStyle);
|
||||
}
|
||||
commonStyle.Add(selectedStyle);
|
||||
@ -71,7 +71,7 @@ internal class CardTabStripItemTheme : BaseTabStripItemTheme
|
||||
var largeSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(TabStripItem.SizeTypeProperty, SizeType.Large));
|
||||
{
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlResourceKey.CardPaddingLG);
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlTokenResourceKey.CardPaddingLG);
|
||||
largeSizeStyle.Add(decoratorStyle);
|
||||
}
|
||||
topOrBottomStyle.Add(largeSizeStyle);
|
||||
@ -79,7 +79,7 @@ internal class CardTabStripItemTheme : BaseTabStripItemTheme
|
||||
var middleSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(TabStripItem.SizeTypeProperty, SizeType.Middle));
|
||||
{
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlResourceKey.CardPadding);
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlTokenResourceKey.CardPadding);
|
||||
middleSizeStyle.Add(decoratorStyle);
|
||||
}
|
||||
topOrBottomStyle.Add(middleSizeStyle);
|
||||
@ -87,7 +87,7 @@ internal class CardTabStripItemTheme : BaseTabStripItemTheme
|
||||
var smallSizeType = new Style(selector => selector.Nesting().PropertyEquals(TabStripItem.SizeTypeProperty, SizeType.Small));
|
||||
{
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlResourceKey.CardPaddingSM);
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlTokenResourceKey.CardPaddingSM);
|
||||
smallSizeType.Add(decoratorStyle);
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ internal class CardTabStripItemTheme : BaseTabStripItemTheme
|
||||
var largeSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(TabStripItem.SizeTypeProperty, SizeType.Large));
|
||||
{
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlResourceKey.VerticalItemPadding);
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlTokenResourceKey.VerticalItemPadding);
|
||||
largeSizeStyle.Add(decoratorStyle);
|
||||
}
|
||||
leftOrRightStyle.Add(largeSizeStyle);
|
||||
@ -109,7 +109,7 @@ internal class CardTabStripItemTheme : BaseTabStripItemTheme
|
||||
var middleSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(TabStripItem.SizeTypeProperty, SizeType.Middle));
|
||||
{
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlResourceKey.VerticalItemPadding);
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlTokenResourceKey.VerticalItemPadding);
|
||||
middleSizeStyle.Add(decoratorStyle);
|
||||
}
|
||||
leftOrRightStyle.Add(middleSizeStyle);
|
||||
@ -117,7 +117,7 @@ internal class CardTabStripItemTheme : BaseTabStripItemTheme
|
||||
var smallSizeType = new Style(selector => selector.Nesting().PropertyEquals(TabStripItem.SizeTypeProperty, SizeType.Small));
|
||||
{
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlResourceKey.VerticalItemPadding);
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlTokenResourceKey.VerticalItemPadding);
|
||||
smallSizeType.Add(decoratorStyle);
|
||||
}
|
||||
|
||||
@ -138,7 +138,7 @@ internal class CardTabStripItemTheme : BaseTabStripItemTheme
|
||||
topStyle.Add(iconStyle);
|
||||
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.BorderBrushProperty, GlobalResourceKey.ColorBorderSecondary);
|
||||
decoratorStyle.Add(Border.BorderBrushProperty, GlobalTokenResourceKey.ColorBorderSecondary);
|
||||
|
||||
Add(topStyle);
|
||||
}
|
||||
@ -174,7 +174,7 @@ internal class CardTabStripItemTheme : BaseTabStripItemTheme
|
||||
{
|
||||
var disabledStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Disabled));
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.BackgroundProperty, GlobalResourceKey.ColorBgContainerDisabled);
|
||||
decoratorStyle.Add(Border.BackgroundProperty, GlobalTokenResourceKey.ColorBgContainerDisabled);
|
||||
disabledStyle.Add(decoratorStyle);
|
||||
Add(disabledStyle);
|
||||
}
|
||||
|
@ -46,12 +46,12 @@ internal class CardTabStripTheme : BaseTabStripTheme
|
||||
Kind = "PlusOutlined"
|
||||
};
|
||||
|
||||
TokenResourceBinder.CreateTokenBinding(addTabIcon, PathIcon.NormalFilledBrushProperty, TabControlResourceKey.ItemColor);
|
||||
TokenResourceBinder.CreateTokenBinding(addTabIcon, PathIcon.ActiveFilledBrushProperty, TabControlResourceKey.ItemHoverColor);
|
||||
TokenResourceBinder.CreateTokenBinding(addTabIcon, PathIcon.DisabledFilledBrushProperty, GlobalResourceKey.ColorTextDisabled);
|
||||
TokenResourceBinder.CreateTokenBinding(addTabIcon, PathIcon.NormalFilledBrushProperty, TabControlTokenResourceKey.ItemColor);
|
||||
TokenResourceBinder.CreateTokenBinding(addTabIcon, PathIcon.ActiveFilledBrushProperty, TabControlTokenResourceKey.ItemHoverColor);
|
||||
TokenResourceBinder.CreateTokenBinding(addTabIcon, PathIcon.DisabledFilledBrushProperty, GlobalTokenResourceKey.ColorTextDisabled);
|
||||
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(addTabIcon, PathIcon.WidthProperty, GlobalResourceKey.IconSize);
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(addTabIcon, PathIcon.HeightProperty, GlobalResourceKey.IconSize);
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(addTabIcon, PathIcon.WidthProperty, GlobalTokenResourceKey.IconSize);
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(addTabIcon, PathIcon.HeightProperty, GlobalTokenResourceKey.IconSize);
|
||||
|
||||
var addTabButton = new IconButton
|
||||
{
|
||||
@ -64,7 +64,7 @@ internal class CardTabStripTheme : BaseTabStripTheme
|
||||
CreateTemplateParentBinding(addTabButton, IconButton.CornerRadiusProperty, CardTabStrip.CardBorderRadiusProperty);
|
||||
CreateTemplateParentBinding(addTabButton, IconButton.IsVisibleProperty, CardTabStrip.IsShowAddTabButtonProperty);
|
||||
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(addTabButton, IconButton.BorderBrushProperty, GlobalResourceKey.ColorBorderSecondary);
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(addTabButton, IconButton.BorderBrushProperty, GlobalTokenResourceKey.ColorBorderSecondary);
|
||||
|
||||
addTabButton.RegisterInNameScope(scope);
|
||||
|
||||
@ -103,10 +103,10 @@ internal class CardTabStripTheme : BaseTabStripTheme
|
||||
|
||||
var itemPresenterPanelStyle = new Style(selector => selector.Nesting().Template().Name(ItemsPresenterPart).Child().OfType<StackPanel>());
|
||||
itemPresenterPanelStyle.Add(StackPanel.OrientationProperty, Orientation.Horizontal);
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlResourceKey.CardGutter);
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlTokenResourceKey.CardGutter);
|
||||
|
||||
var addTabButtonStyle = new Style(selector => selector.Nesting().Template().Name(AddTabButtonPart));
|
||||
addTabButtonStyle.Add(IconButton.MarginProperty, TabControlResourceKey.AddTabButtonMarginHorizontal);
|
||||
addTabButtonStyle.Add(IconButton.MarginProperty, TabControlTokenResourceKey.AddTabButtonMarginHorizontal);
|
||||
topStyle.Add(addTabButtonStyle);
|
||||
|
||||
topStyle.Add(itemPresenterPanelStyle);
|
||||
@ -123,11 +123,11 @@ internal class CardTabStripTheme : BaseTabStripTheme
|
||||
|
||||
var itemPresenterPanelStyle = new Style(selector => selector.Nesting().Template().Name(ItemsPresenterPart).Child().OfType<StackPanel>());
|
||||
itemPresenterPanelStyle.Add(StackPanel.OrientationProperty, Orientation.Vertical);
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlResourceKey.CardGutter);
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlTokenResourceKey.CardGutter);
|
||||
rightStyle.Add(itemPresenterPanelStyle);
|
||||
|
||||
var addTabButtonStyle = new Style(selector => selector.Nesting().Template().Name(AddTabButtonPart));
|
||||
addTabButtonStyle.Add(IconButton.MarginProperty, TabControlResourceKey.AddTabButtonMarginVertical);
|
||||
addTabButtonStyle.Add(IconButton.MarginProperty, TabControlTokenResourceKey.AddTabButtonMarginVertical);
|
||||
rightStyle.Add(addTabButtonStyle);
|
||||
|
||||
commonStyle.Add(rightStyle);
|
||||
@ -142,11 +142,11 @@ internal class CardTabStripTheme : BaseTabStripTheme
|
||||
|
||||
var itemPresenterPanelStyle = new Style(selector => selector.Nesting().Template().Name(ItemsPresenterPart).Child().OfType<StackPanel>());
|
||||
itemPresenterPanelStyle.Add(StackPanel.OrientationProperty, Orientation.Horizontal);
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlResourceKey.CardGutter);
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlTokenResourceKey.CardGutter);
|
||||
bottomStyle.Add(itemPresenterPanelStyle);
|
||||
|
||||
var addTabButtonStyle = new Style(selector => selector.Nesting().Template().Name(AddTabButtonPart));
|
||||
addTabButtonStyle.Add(IconButton.MarginProperty, TabControlResourceKey.AddTabButtonMarginHorizontal);
|
||||
addTabButtonStyle.Add(IconButton.MarginProperty, TabControlTokenResourceKey.AddTabButtonMarginHorizontal);
|
||||
bottomStyle.Add(addTabButtonStyle);
|
||||
|
||||
commonStyle.Add(bottomStyle);
|
||||
@ -161,11 +161,11 @@ internal class CardTabStripTheme : BaseTabStripTheme
|
||||
|
||||
var itemPresenterPanelStyle = new Style(selector => selector.Nesting().Template().Name(ItemsPresenterPart).Child().OfType<StackPanel>());
|
||||
itemPresenterPanelStyle.Add(StackPanel.OrientationProperty, Orientation.Vertical);
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlResourceKey.CardGutter);
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlTokenResourceKey.CardGutter);
|
||||
leftStyle.Add(itemPresenterPanelStyle);
|
||||
|
||||
var addTabButtonStyle = new Style(selector => selector.Nesting().Template().Name(AddTabButtonPart));
|
||||
addTabButtonStyle.Add(IconButton.MarginProperty, TabControlResourceKey.AddTabButtonMarginVertical);
|
||||
addTabButtonStyle.Add(IconButton.MarginProperty, TabControlTokenResourceKey.AddTabButtonMarginVertical);
|
||||
leftStyle.Add(addTabButtonStyle);
|
||||
|
||||
commonStyle.Add(leftStyle);
|
||||
|
@ -51,7 +51,7 @@ public class TabStrip : BaseTabStrip
|
||||
if (_selectedIndicator.Transitions is null) {
|
||||
var transitions = new Transitions();
|
||||
transitions.Add(AnimationUtils.CreateTransition<TransformOperationsTransition>(Border.RenderTransformProperty,
|
||||
GlobalResourceKey.MotionDurationSlow, new ExponentialEaseOut()));
|
||||
GlobalTokenResourceKey.MotionDurationSlow, new ExponentialEaseOut()));
|
||||
_selectedIndicator.Transitions = transitions;
|
||||
// 只需要执行一次
|
||||
LayoutUpdated -= HandleLayoutUpdated;
|
||||
@ -119,6 +119,6 @@ public class TabStrip : BaseTabStrip
|
||||
_selectedIndicator = e.NameScope.Find<Border>(TabStripTheme.SelectedItemIndicatorPart);
|
||||
_itemsPresenter = e.NameScope.Find<ItemsPresenter>(TabStripTheme.ItemsPresenterPart);
|
||||
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(this, SelectedIndicatorThicknessProperty, GlobalResourceKey.LineWidthBold);
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(this, SelectedIndicatorThicknessProperty, GlobalTokenResourceKey.LineWidthBold);
|
||||
}
|
||||
}
|
@ -100,10 +100,10 @@ public class TabStripItem : AvaloniaTabStripItem, IControlCustomStyle, ICustomHi
|
||||
UIStructureUtils.SetTemplateParent(Icon, this);
|
||||
Icon.Name = BaseTabStripItemTheme.ItemIconPart;
|
||||
if (Icon.ThemeType != IconThemeType.TwoTone) {
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.NormalFilledBrushProperty, TabControlResourceKey.ItemColor);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.ActiveFilledBrushProperty, TabControlResourceKey.ItemHoverColor);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.SelectedFilledBrushProperty, TabControlResourceKey.ItemSelectedColor);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.DisabledFilledBrushProperty, GlobalResourceKey.ColorTextDisabled);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.NormalFilledBrushProperty, TabControlTokenResourceKey.ItemColor);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.ActiveFilledBrushProperty, TabControlTokenResourceKey.ItemHoverColor);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.SelectedFilledBrushProperty, TabControlTokenResourceKey.ItemSelectedColor);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.DisabledFilledBrushProperty, GlobalTokenResourceKey.ColorTextDisabled);
|
||||
}
|
||||
if (_contentLayout is not null) {
|
||||
_contentLayout.Children.Insert(0, Icon);
|
||||
@ -118,17 +118,17 @@ public class TabStripItem : AvaloniaTabStripItem, IControlCustomStyle, ICustomHi
|
||||
{
|
||||
Kind = "CloseOutlined"
|
||||
};
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(CloseIcon, PathIcon.WidthProperty, GlobalResourceKey.IconSizeSM);
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(CloseIcon, PathIcon.HeightProperty, GlobalResourceKey.IconSizeSM);
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(CloseIcon, PathIcon.WidthProperty, GlobalTokenResourceKey.IconSizeSM);
|
||||
TokenResourceBinder.CreateGlobalResourceBinding(CloseIcon, PathIcon.HeightProperty, GlobalTokenResourceKey.IconSizeSM);
|
||||
}
|
||||
|
||||
CloseIcon.SetValue(PathIcon.VerticalAlignmentProperty, VerticalAlignment.Center);
|
||||
|
||||
UIStructureUtils.SetTemplateParent(CloseIcon, this);
|
||||
if (CloseIcon.ThemeType != IconThemeType.TwoTone) {
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.NormalFilledBrushProperty, GlobalResourceKey.ColorIcon);
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.ActiveFilledBrushProperty, GlobalResourceKey.ColorIconHover);
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.DisabledFilledBrushProperty, GlobalResourceKey.ColorTextDisabled);
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorIcon);
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.ActiveFilledBrushProperty, GlobalTokenResourceKey.ColorIconHover);
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.DisabledFilledBrushProperty, GlobalTokenResourceKey.ColorTextDisabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,12 +28,12 @@ internal class TabStripItemTheme : BaseTabStripItemTheme
|
||||
selector.Nesting().PropertyEquals(TabStripItem.TabStripPlacementProperty, Dock.Bottom)));
|
||||
|
||||
{
|
||||
topOrBottomStyle.Add(Border.MarginProperty, TabControlResourceKey.HorizontalItemMargin);
|
||||
topOrBottomStyle.Add(Border.MarginProperty, TabControlTokenResourceKey.HorizontalItemMargin);
|
||||
|
||||
var largeSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(TabStripItem.SizeTypeProperty, SizeType.Large));
|
||||
{
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlResourceKey.HorizontalItemPaddingLG);
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlTokenResourceKey.HorizontalItemPaddingLG);
|
||||
largeSizeStyle.Add(decoratorStyle);
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ internal class TabStripItemTheme : BaseTabStripItemTheme
|
||||
var middleSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(TabStripItem.SizeTypeProperty, SizeType.Middle));
|
||||
{
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlResourceKey.HorizontalItemPadding);
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlTokenResourceKey.HorizontalItemPadding);
|
||||
middleSizeStyle.Add(decoratorStyle);
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ internal class TabStripItemTheme : BaseTabStripItemTheme
|
||||
var smallSizeType = new Style(selector => selector.Nesting().PropertyEquals(TabStripItem.SizeTypeProperty, SizeType.Small));
|
||||
{
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlResourceKey.HorizontalItemPaddingSM);
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlTokenResourceKey.HorizontalItemPaddingSM);
|
||||
smallSizeType.Add(decoratorStyle);
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ internal class TabStripItemTheme : BaseTabStripItemTheme
|
||||
var largeSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(TabStripItem.SizeTypeProperty, SizeType.Large));
|
||||
{
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlResourceKey.VerticalItemPadding);
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlTokenResourceKey.VerticalItemPadding);
|
||||
largeSizeStyle.Add(decoratorStyle);
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ internal class TabStripItemTheme : BaseTabStripItemTheme
|
||||
var middleSizeStyle = new Style(selector => selector.Nesting().PropertyEquals(TabStripItem.SizeTypeProperty, SizeType.Middle));
|
||||
{
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlResourceKey.VerticalItemPadding);
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlTokenResourceKey.VerticalItemPadding);
|
||||
middleSizeStyle.Add(decoratorStyle);
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ internal class TabStripItemTheme : BaseTabStripItemTheme
|
||||
var smallSizeType = new Style(selector => selector.Nesting().PropertyEquals(TabStripItem.SizeTypeProperty, SizeType.Small));
|
||||
{
|
||||
var decoratorStyle = new Style(selector => selector.Nesting().Template().Name(DecoratorPart));
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlResourceKey.VerticalItemPadding);
|
||||
decoratorStyle.Add(Border.PaddingProperty, TabControlTokenResourceKey.VerticalItemPadding);
|
||||
smallSizeType.Add(decoratorStyle);
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ internal class TabStripTheme : BaseTabStripTheme
|
||||
Name = SelectedItemIndicatorPart,
|
||||
};
|
||||
border.RegisterInNameScope(scope);
|
||||
TokenResourceBinder.CreateTokenBinding(border, Border.BackgroundProperty, TabControlResourceKey.InkBarColor);
|
||||
TokenResourceBinder.CreateTokenBinding(border, Border.BackgroundProperty, TabControlTokenResourceKey.InkBarColor);
|
||||
|
||||
layout.Children.Add(itemsPresenter);
|
||||
layout.Children.Add(border);
|
||||
@ -69,7 +69,7 @@ internal class TabStripTheme : BaseTabStripTheme
|
||||
var topStyle = new Style(selector => selector.Nesting().Class(BaseTabStrip.TopPC));
|
||||
|
||||
var itemPresenterPanelStyle = new Style(selector => selector.Nesting().Template().Name(ItemsPresenterPart).Child().OfType<StackPanel>());
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlResourceKey.HorizontalItemGutter);
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlTokenResourceKey.HorizontalItemGutter);
|
||||
itemPresenterPanelStyle.Add(StackPanel.OrientationProperty, Orientation.Horizontal);
|
||||
|
||||
topStyle.Add(itemPresenterPanelStyle);
|
||||
@ -89,7 +89,7 @@ internal class TabStripTheme : BaseTabStripTheme
|
||||
|
||||
var itemPresenterPanelStyle = new Style(selector => selector.Nesting().Template().Name(ItemsPresenterPart).Child().OfType<StackPanel>());
|
||||
itemPresenterPanelStyle.Add(StackPanel.OrientationProperty, Orientation.Vertical);
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlResourceKey.VerticalItemGutter);
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlTokenResourceKey.VerticalItemGutter);
|
||||
rightStyle.Add(itemPresenterPanelStyle);
|
||||
|
||||
var indicatorStyle = new Style(selector => selector.Nesting().Template().Name(SelectedItemIndicatorPart));
|
||||
@ -104,7 +104,7 @@ internal class TabStripTheme : BaseTabStripTheme
|
||||
var bottomStyle = new Style(selector => selector.Nesting().Class(BaseTabStrip.BottomPC));
|
||||
|
||||
var itemPresenterPanelStyle = new Style(selector => selector.Nesting().Template().Name(ItemsPresenterPart).Child().OfType<StackPanel>());
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlResourceKey.HorizontalItemGutter);
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlTokenResourceKey.HorizontalItemGutter);
|
||||
itemPresenterPanelStyle.Add(StackPanel.OrientationProperty, Orientation.Horizontal);
|
||||
bottomStyle.Add(itemPresenterPanelStyle);
|
||||
|
||||
@ -121,7 +121,7 @@ internal class TabStripTheme : BaseTabStripTheme
|
||||
|
||||
var itemPresenterPanelStyle = new Style(selector => selector.Nesting().Template().Name(ItemsPresenterPart).Child().OfType<StackPanel>());
|
||||
itemPresenterPanelStyle.Add(StackPanel.OrientationProperty, Orientation.Vertical);
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlResourceKey.VerticalItemGutter);
|
||||
itemPresenterPanelStyle.Add(StackPanel.SpacingProperty, TabControlTokenResourceKey.VerticalItemGutter);
|
||||
leftStyle.Add(itemPresenterPanelStyle);
|
||||
|
||||
var indicatorStyle = new Style(selector => selector.Nesting().Template().Name(SelectedItemIndicatorPart));
|
||||
|
@ -220,7 +220,7 @@ public class Tag : TemplatedControl, IControlCustomStyle
|
||||
|
||||
void IControlCustomStyle.SetupTokenBindings()
|
||||
{
|
||||
TokenResourceBinder.CreateTokenBinding(this, BorderThicknessProperty, GlobalResourceKey.BorderThickness, BindingPriority.Template,
|
||||
TokenResourceBinder.CreateTokenBinding(this, BorderThicknessProperty, GlobalTokenResourceKey.BorderThickness, BindingPriority.Template,
|
||||
new RenderScaleAwareThicknessConfigure(this, thickness =>
|
||||
{
|
||||
if (!Bordered) {
|
||||
@ -345,7 +345,7 @@ public class Tag : TemplatedControl, IControlCustomStyle
|
||||
Bordered = false;
|
||||
_hasColorSet = true;
|
||||
Background = new SolidColorBrush(color);
|
||||
TokenResourceBinder.CreateTokenBinding(this, ForegroundProperty, GlobalResourceKey.ColorTextLightSolid);
|
||||
TokenResourceBinder.CreateTokenBinding(this, ForegroundProperty, GlobalTokenResourceKey.ColorTextLightSolid);
|
||||
}
|
||||
}
|
||||
|
||||
@ -358,13 +358,13 @@ public class Tag : TemplatedControl, IControlCustomStyle
|
||||
Kind = "CloseOutlined"
|
||||
};
|
||||
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.WidthProperty, TagResourceKey.TagCloseIconSize);
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.HeightProperty, TagResourceKey.TagCloseIconSize);
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.WidthProperty, TagTokenResourceKey.TagCloseIconSize);
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.HeightProperty, TagTokenResourceKey.TagCloseIconSize);
|
||||
if (_hasColorSet && !_isPresetColorTag) {
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.NormalFilledBrushProperty, GlobalResourceKey.ColorTextLightSolid);
|
||||
TokenResourceBinder.CreateTokenBinding(CloseIcon, PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorTextLightSolid);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -376,11 +376,11 @@ public class Tag : TemplatedControl, IControlCustomStyle
|
||||
if (_layoutPanel?.Children[0] is PathIcon oldIcon) {
|
||||
_layoutPanel.Children.Remove(oldIcon);
|
||||
}
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.WidthProperty, TagResourceKey.TagIconSize);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.HeightProperty, TagResourceKey.TagIconSize);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.WidthProperty, TagTokenResourceKey.TagIconSize);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.HeightProperty, TagTokenResourceKey.TagIconSize);
|
||||
_layoutPanel?.Children.Insert(0, Icon);
|
||||
if (_hasColorSet) {
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.NormalFilledBrushProperty, GlobalResourceKey.ColorTextLightSolid);
|
||||
TokenResourceBinder.CreateTokenBinding(Icon, PathIcon.NormalFilledBrushProperty, GlobalTokenResourceKey.ColorTextLightSolid);
|
||||
} else if (_isPresetColorTag) {
|
||||
Icon.NormalFilledBrush = Foreground;
|
||||
}
|
||||
|
@ -21,13 +21,13 @@ internal class TagTheme : BaseControlTheme
|
||||
|
||||
protected override void BuildStyles()
|
||||
{
|
||||
this.Add(Tag.BackgroundProperty, TagResourceKey.DefaultBg);
|
||||
this.Add(Tag.ForegroundProperty, TagResourceKey.DefaultColor);
|
||||
this.Add(Tag.FontSizeProperty, TagResourceKey.TagFontSize);
|
||||
this.Add(Tag.PaddingProperty, TagResourceKey.TagPadding);
|
||||
this.Add(Tag.BorderBrushProperty, GlobalResourceKey.ColorBorder);
|
||||
this.Add(Tag.CornerRadiusProperty, GlobalResourceKey.BorderRadiusSM);
|
||||
this.Add(Tag.TagTextPaddingInlineProperty, TagResourceKey.TagTextPaddingInline);
|
||||
this.Add(Tag.BackgroundProperty, TagTokenResourceKey.DefaultBg);
|
||||
this.Add(Tag.ForegroundProperty, TagTokenResourceKey.DefaultColor);
|
||||
this.Add(Tag.FontSizeProperty, TagTokenResourceKey.TagFontSize);
|
||||
this.Add(Tag.PaddingProperty, TagTokenResourceKey.TagPadding);
|
||||
this.Add(Tag.BorderBrushProperty, GlobalTokenResourceKey.ColorBorder);
|
||||
this.Add(Tag.CornerRadiusProperty, GlobalTokenResourceKey.BorderRadiusSM);
|
||||
this.Add(Tag.TagTextPaddingInlineProperty, TagTokenResourceKey.TagTextPaddingInline);
|
||||
}
|
||||
|
||||
protected override IControlTemplate BuildControlTemplate()
|
||||
@ -55,10 +55,10 @@ internal class TagTheme : BaseControlTheme
|
||||
};
|
||||
closeBtn.RegisterInNameScope(scope);
|
||||
|
||||
TokenResourceBinder.CreateTokenBinding(closeBtn, IconButton.WidthProperty, GlobalResourceKey.IconSizeSM);
|
||||
TokenResourceBinder.CreateTokenBinding(closeBtn, IconButton.HeightProperty, GlobalResourceKey.IconSizeSM);
|
||||
TokenResourceBinder.CreateTokenBinding(textBlock, TextBlock.HeightProperty, TagResourceKey.TagLineHeight);
|
||||
TokenResourceBinder.CreateTokenBinding(textBlock, TextBlock.LineHeightProperty, TagResourceKey.TagLineHeight);
|
||||
TokenResourceBinder.CreateTokenBinding(closeBtn, IconButton.WidthProperty, GlobalTokenResourceKey.IconSizeSM);
|
||||
TokenResourceBinder.CreateTokenBinding(closeBtn, IconButton.HeightProperty, GlobalTokenResourceKey.IconSizeSM);
|
||||
TokenResourceBinder.CreateTokenBinding(textBlock, TextBlock.HeightProperty, TagTokenResourceKey.TagLineHeight);
|
||||
TokenResourceBinder.CreateTokenBinding(textBlock, TextBlock.LineHeightProperty, TagTokenResourceKey.TagLineHeight);
|
||||
|
||||
CreateTemplateParentBinding(closeBtn, IconButton.IsVisibleProperty, Tag.IsClosableProperty);
|
||||
CreateTemplateParentBinding(closeBtn, IconButton.IconProperty, Tag.CloseIconProperty);
|
||||
|
@ -637,7 +637,7 @@ public class ToolTip : TemplatedControl,
|
||||
|
||||
SetPopupParent(_popup, control);
|
||||
|
||||
TokenResourceBinder.CreateTokenBinding(_popup, Popup.MaskShadowsProperty, GlobalResourceKey.BoxShadowsSecondary);
|
||||
TokenResourceBinder.CreateTokenBinding(_popup, Popup.MaskShadowsProperty, GlobalTokenResourceKey.BoxShadowsSecondary);
|
||||
SetToolTipColor(control);
|
||||
|
||||
var marginToAnchor = GetMarginToAnchor(control);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user