mirror of
https://github.com/AtomUI/AtomUI.git
synced 2026-10-22 00:46:48 +08:00
Refactor CheckBox
use xaml theme
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
Id="AtomUI.Controls">
|
||||
<atom:ControlThemesProvider.ControlThemes>
|
||||
<ResourceInclude Source="Alert/Themes/AlertTheme.axaml" />
|
||||
<ResourceInclude Source="CheckBox/Themes/CheckBoxTheme.axaml" />
|
||||
<ResourceInclude Source="Tag/Themes/TagTheme.axaml" />
|
||||
<ResourceInclude Source="Pagination/Themes/PaginationThemes.axaml" />
|
||||
<ResourceInclude Source="ScrollBar/Themes/ScrollBarThemes.axaml" />
|
||||
|
||||
@@ -101,7 +101,7 @@ public class SplitButton : ContentControl,
|
||||
AvaloniaProperty.Register<SplitButton, bool>(nameof(IsPrimaryButtonType));
|
||||
|
||||
public static readonly StyledProperty<bool> IsMotionEnabledProperty
|
||||
= WaveSpiritAwareControlProperty.IsMotionEnabledProperty.AddOwner<SplitButton>();
|
||||
= MotionAwareControlProperty.IsMotionEnabledProperty.AddOwner<SplitButton>();
|
||||
|
||||
public static readonly StyledProperty<bool> IsWaveSpiritEnabledProperty
|
||||
= WaveSpiritAwareControlProperty.IsWaveSpiritEnabledProperty.AddOwner<SplitButton>();
|
||||
|
||||
@@ -16,7 +16,7 @@ public class CheckBox : AvaloniaCheckBox,
|
||||
#region 公共属性定义
|
||||
|
||||
public static readonly StyledProperty<bool> IsMotionEnabledProperty
|
||||
= WaveSpiritAwareControlProperty.IsMotionEnabledProperty.AddOwner<CheckBox>();
|
||||
= MotionAwareControlProperty.IsMotionEnabledProperty.AddOwner<CheckBox>();
|
||||
|
||||
public static readonly StyledProperty<bool> IsWaveSpiritEnabledProperty
|
||||
= WaveSpiritAwareControlProperty.IsWaveSpiritEnabledProperty.AddOwner<CheckBox>();
|
||||
|
||||
@@ -118,7 +118,7 @@ internal class CheckBoxIndicator : Control,
|
||||
#region 内部属性定义
|
||||
|
||||
internal static readonly StyledProperty<bool> IsMotionEnabledProperty
|
||||
= WaveSpiritAwareControlProperty.IsMotionEnabledProperty.AddOwner<CheckBoxIndicator>();
|
||||
= MotionAwareControlProperty.IsMotionEnabledProperty.AddOwner<CheckBoxIndicator>();
|
||||
|
||||
internal static readonly StyledProperty<bool> IsWaveSpiritEnabledProperty
|
||||
= WaveSpiritAwareControlProperty.IsWaveSpiritEnabledProperty.AddOwner<CheckBoxIndicator>();
|
||||
|
||||
@@ -1,191 +0,0 @@
|
||||
using AtomUI.Theme;
|
||||
using AtomUI.Theme.Styling;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Presenters;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Controls.Templates;
|
||||
using Avalonia.Data;
|
||||
using Avalonia.Data.Converters;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.Styling;
|
||||
|
||||
namespace AtomUI.Controls;
|
||||
|
||||
[ControlThemeProvider]
|
||||
internal class CheckBoxTheme : BaseControlTheme
|
||||
{
|
||||
internal const string FramePart = "PART_Frame";
|
||||
internal const string IndicatorPart = "PART_Indicator";
|
||||
internal const string LabelTextPart = "PART_LabelText";
|
||||
|
||||
public CheckBoxTheme()
|
||||
: base(typeof(CheckBox))
|
||||
{
|
||||
}
|
||||
|
||||
protected override IControlTemplate BuildControlTemplate()
|
||||
{
|
||||
return new FuncControlTemplate<CheckBox>((checkBox, scope) =>
|
||||
{
|
||||
var frame = new Border()
|
||||
{
|
||||
Name = FramePart,
|
||||
Padding = new Thickness(0, 1, 0, 1)
|
||||
};
|
||||
CreateTemplateParentBinding(frame, Border.BackgroundProperty, CheckBox.BackgroundProperty);
|
||||
CreateTemplateParentBinding(frame, Border.BorderBrushProperty, CheckBox.BorderBrushProperty);
|
||||
CreateTemplateParentBinding(frame, Border.BorderThicknessProperty, CheckBox.BorderThicknessProperty);
|
||||
CreateTemplateParentBinding(frame, Border.CornerRadiusProperty, CheckBox.CornerRadiusProperty);
|
||||
|
||||
var layout = new DockPanel
|
||||
{
|
||||
LastChildFill = true
|
||||
};
|
||||
|
||||
var indicator = new CheckBoxIndicator()
|
||||
{
|
||||
Name = IndicatorPart
|
||||
};
|
||||
|
||||
DockPanel.SetDock(indicator, Dock.Left);
|
||||
CreateTemplateParentBinding(indicator, CheckBoxIndicator.IsMotionEnabledProperty, CheckBox.IsMotionEnabledProperty);
|
||||
CreateTemplateParentBinding(indicator, CheckBoxIndicator.IsWaveSpiritEnabledProperty, CheckBox.IsWaveSpiritEnabledProperty);
|
||||
CreateTemplateParentBinding(indicator, CheckBoxIndicator.IsEnabledProperty, CheckBox.IsEnabledProperty);
|
||||
CreateTemplateParentBinding(indicator, CheckBoxIndicator.IsCheckedProperty, CheckBox.IsCheckedProperty);
|
||||
layout.Children.Add(indicator);
|
||||
|
||||
var labelText = new TextBlock()
|
||||
{
|
||||
Name = LabelTextPart,
|
||||
VerticalAlignment = VerticalAlignment.Center,
|
||||
};
|
||||
CreateTemplateParentBinding(labelText, TextBlock.TextProperty, CheckBox.ContentProperty);
|
||||
CreateTemplateParentBinding(labelText, TextBlock.FontSizeProperty, CheckBox.FontSizeProperty);
|
||||
CreateTemplateParentBinding(labelText, TextBlock.IsVisibleProperty, CheckBox.ContentProperty,
|
||||
BindingMode.Default,
|
||||
ObjectConverters.IsNotNull);
|
||||
layout.Children.Add(labelText);
|
||||
frame.Child = layout;
|
||||
return frame;
|
||||
});
|
||||
}
|
||||
|
||||
protected override void BuildStyles()
|
||||
{
|
||||
BuildIndicatorStyle();
|
||||
|
||||
var commonStyle = new Style(selector => selector.Nesting());
|
||||
commonStyle.Add(CheckBox.CursorProperty, new SetterValueFactory<Cursor>(()=> new Cursor(StandardCursorType.Hand)));
|
||||
commonStyle.Add(CheckBox.HorizontalAlignmentProperty, HorizontalAlignment.Left);
|
||||
|
||||
var labelTextStyle = new Style(selector => selector.Nesting().Template().Name(LabelTextPart));
|
||||
labelTextStyle.Add(ContentPresenter.MarginProperty, CheckBoxTokenKey.TextMargin);
|
||||
commonStyle.Add(labelTextStyle);
|
||||
|
||||
Add(commonStyle);
|
||||
|
||||
var disableStyle =
|
||||
new Style(selector => selector.Nesting().PropertyEquals(InputElement.IsEnabledProperty, false));
|
||||
disableStyle.Add(TemplatedControl.ForegroundProperty, SharedTokenKey.ColorTextDisabled);
|
||||
Add(disableStyle);
|
||||
var enabledStyle =
|
||||
new Style(selector => selector.Nesting().PropertyEquals(InputElement.IsEnabledProperty, true));
|
||||
enabledStyle.Add(TemplatedControl.ForegroundProperty, SharedTokenKey.ColorText);
|
||||
Add(enabledStyle);
|
||||
}
|
||||
|
||||
private void BuildIndicatorStyle()
|
||||
{
|
||||
{
|
||||
var indicatorStyle = new Style(selector => selector.Nesting().Template().Name(IndicatorPart));
|
||||
indicatorStyle.Add(CheckBoxIndicator.SizeProperty, CheckBoxTokenKey.CheckIndicatorSize);
|
||||
indicatorStyle.Add(CheckBoxIndicator.WidthProperty, CheckBoxTokenKey.CheckIndicatorSize);
|
||||
indicatorStyle.Add(CheckBoxIndicator.HeightProperty, CheckBoxTokenKey.CheckIndicatorSize);
|
||||
indicatorStyle.Add(CheckBoxIndicator.CornerRadiusProperty, SharedTokenKey.BorderRadiusSM);
|
||||
indicatorStyle.Add(CheckBoxIndicator.TristateMarkSizeProperty, CheckBoxTokenKey.IndicatorTristateMarkSize);
|
||||
indicatorStyle.Add(CheckBoxIndicator.TristateMarkBrushProperty, SharedTokenKey.ColorPrimary);
|
||||
Add(indicatorStyle);
|
||||
}
|
||||
|
||||
var disableStyle =
|
||||
new Style(selector => selector.Nesting().PropertyEquals(InputElement.IsEnabledProperty, false));
|
||||
{
|
||||
{
|
||||
var indicatorStyle = new Style(selector => selector.Nesting().Template().Name(IndicatorPart));
|
||||
indicatorStyle.Add(CheckBoxIndicator.BackgroundProperty, SharedTokenKey.ColorBgContainerDisabled);
|
||||
indicatorStyle.Add(CheckBoxIndicator.BorderBrushProperty, SharedTokenKey.ColorBorder);
|
||||
disableStyle.Add(indicatorStyle);
|
||||
}
|
||||
var checkedStyle =
|
||||
new Style(selector => selector.Nesting().PropertyEquals(ToggleButton.IsCheckedProperty, true));
|
||||
{
|
||||
var indicatorStyle = new Style(selector => selector.Nesting().Template().Name(IndicatorPart));
|
||||
indicatorStyle.Add(CheckBoxIndicator.CheckedMarkBrushProperty, SharedTokenKey.ColorTextDisabled);
|
||||
checkedStyle.Add(indicatorStyle);
|
||||
}
|
||||
disableStyle.Add(checkedStyle);
|
||||
|
||||
var indeterminateStyle =
|
||||
new Style(selector => selector.Nesting().PropertyEquals(ToggleButton.IsCheckedProperty, null));
|
||||
{
|
||||
var indicatorStyle = new Style(selector => selector.Nesting().Template().Name(IndicatorPart));
|
||||
indicatorStyle.Add(CheckBoxIndicator.TristateMarkBrushProperty, SharedTokenKey.ColorTextDisabled);
|
||||
indeterminateStyle.Add(indicatorStyle);
|
||||
}
|
||||
disableStyle.Add(indeterminateStyle);
|
||||
}
|
||||
|
||||
Add(disableStyle);
|
||||
|
||||
var enabledStyle =
|
||||
new Style(selector => selector.Nesting().PropertyEquals(InputElement.IsEnabledProperty, true));
|
||||
|
||||
{
|
||||
{
|
||||
var indicatorStyle = new Style(selector => selector.Nesting().Template().Name(IndicatorPart));
|
||||
indicatorStyle.Add(CheckBoxIndicator.BackgroundProperty, SharedTokenKey.ColorBgContainer);
|
||||
indicatorStyle.Add(CheckBoxIndicator.CheckedMarkBrushProperty, SharedTokenKey.ColorBgContainer);
|
||||
indicatorStyle.Add(CheckBoxIndicator.BorderBrushProperty, SharedTokenKey.ColorBorder);
|
||||
enabledStyle.Add(indicatorStyle);
|
||||
}
|
||||
|
||||
var checkedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.Checked));
|
||||
{
|
||||
var indicatorStyle = new Style(selector => selector.Nesting().Template().Name(IndicatorPart));
|
||||
indicatorStyle.Add(CheckBoxIndicator.BackgroundProperty, SharedTokenKey.ColorPrimary);
|
||||
indicatorStyle.Add(CheckBoxIndicator.BorderBrushProperty, SharedTokenKey.ColorPrimary);
|
||||
checkedStyle.Add(indicatorStyle);
|
||||
}
|
||||
|
||||
var checkedHoverStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver));
|
||||
{
|
||||
var indicatorStyle = new Style(selector => selector.Nesting().Template().Name(IndicatorPart));
|
||||
indicatorStyle.Add(CheckBoxIndicator.BackgroundProperty, SharedTokenKey.ColorPrimaryHover);
|
||||
indicatorStyle.Add(CheckBoxIndicator.BorderBrushProperty, SharedTokenKey.ColorPrimaryHover);
|
||||
checkedHoverStyle.Add(indicatorStyle);
|
||||
}
|
||||
checkedStyle.Add(checkedHoverStyle);
|
||||
enabledStyle.Add(checkedStyle);
|
||||
|
||||
var unCheckedStyle = new Style(selector => selector.Nesting().Class(StdPseudoClass.PointerOver));
|
||||
{
|
||||
var indicatorStyle = new Style(selector => selector.Nesting().Template().Name(IndicatorPart));
|
||||
indicatorStyle.Add(CheckBoxIndicator.BorderBrushProperty, SharedTokenKey.ColorPrimaryHover);
|
||||
unCheckedStyle.Add(indicatorStyle);
|
||||
}
|
||||
enabledStyle.Add(unCheckedStyle);
|
||||
|
||||
var indeterminateStyle = new Style(selector =>
|
||||
selector.Nesting().Class($"{StdPseudoClass.Indeterminate} {StdPseudoClass.PointerOver}"));
|
||||
{
|
||||
var indicatorStyle = new Style(selector => selector.Nesting().Template().Name(IndicatorPart));
|
||||
indicatorStyle.Add(CheckBoxIndicator.BorderBrushProperty, SharedTokenKey.ColorPrimaryHover);
|
||||
indeterminateStyle.Add(indicatorStyle);
|
||||
}
|
||||
enabledStyle.Add(indeterminateStyle);
|
||||
}
|
||||
Add(enabledStyle);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace AtomUI.Controls;
|
||||
|
||||
internal static class CheckBoxThemeConstants
|
||||
{
|
||||
public const string FramePart = "PART_Frame";
|
||||
public const string IndicatorPart = "PART_Indicator";
|
||||
public const string LabelTextPart = "PART_LabelText";
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:atom="https://atomui.net">
|
||||
<ControlTheme x:Key="{x:Type atom:CheckBox}" TargetType="atom:CheckBox">
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<Border Name="{x:Static atom:CheckBoxThemeConstants.FramePart}"
|
||||
Padding="0, 1, 0, 1"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<DockPanel LastChildFill="True">
|
||||
<atom:CheckBoxIndicator Name="{x:Static atom:CheckBoxThemeConstants.IndicatorPart}"
|
||||
DockPanel.Dock="Left"
|
||||
IsMotionEnabled="{TemplateBinding IsMotionEnabled}"
|
||||
IsWaveSpiritEnabled="{TemplateBinding IsWaveSpiritEnabled}"
|
||||
IsEnabled="{TemplateBinding IsEnabled}"
|
||||
IsChecked="{TemplateBinding IsChecked}" />
|
||||
<atom:TextBlock Name="{x:Static atom:CheckBoxThemeConstants.LabelTextPart}"
|
||||
VerticalAlignment="Center"
|
||||
Text="{TemplateBinding Content}"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
IsVisible="{TemplateBinding Content, Converter={x:Static ObjectConverters.IsNotNull}}" />
|
||||
</DockPanel>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static atom:SharedTokenKey.ColorText}}" />
|
||||
|
||||
<Style Selector="^ /template/ atom|TextBlock#PART_LabelText">
|
||||
<Setter Property="Margin" Value="{DynamicResource {x:Static atom:CheckBoxTokenKey.TextMargin}}" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:disabled">
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static atom:SharedTokenKey.ColorTextDisabled}}" />
|
||||
</Style>
|
||||
|
||||
<!-- BuildIndicatorStyle 开始 -->
|
||||
<Style Selector="^ /template/ atom|CheckBoxIndicator#PART_Indicator">
|
||||
<Setter Property="Size" Value="{DynamicResource {x:Static atom:CheckBoxTokenKey.CheckIndicatorSize}}" />
|
||||
<Setter Property="Width" Value="{DynamicResource {x:Static atom:CheckBoxTokenKey.CheckIndicatorSize}}" />
|
||||
<Setter Property="Height" Value="{DynamicResource {x:Static atom:CheckBoxTokenKey.CheckIndicatorSize}}" />
|
||||
<Setter Property="CornerRadius" Value="{DynamicResource {x:Static atom:SharedTokenKey.BorderRadiusSM}}" />
|
||||
<Setter Property="TristateMarkSize"
|
||||
Value="{DynamicResource {x:Static atom:CheckBoxTokenKey.IndicatorTristateMarkSize}}" />
|
||||
<Setter Property="TristateMarkBrush" Value="{DynamicResource {x:Static atom:SharedTokenKey.ColorPrimary}}" />
|
||||
<Setter Property="CheckedMarkBrush"
|
||||
Value="{DynamicResource {x:Static atom:SharedTokenKey.ColorBgContainer}}" />
|
||||
<Setter Property="Background" Value="{DynamicResource {x:Static atom:SharedTokenKey.ColorBgContainer}}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static atom:SharedTokenKey.ColorBorder}}" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:checked">
|
||||
<Style Selector="^ /template/ atom|CheckBoxIndicator#PART_Indicator">
|
||||
<Setter Property="Background" Value="{DynamicResource {x:Static atom:SharedTokenKey.ColorPrimary}}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static atom:SharedTokenKey.ColorPrimary}}" />
|
||||
</Style>
|
||||
<Style Selector="^:pointerover">
|
||||
<Style Selector="^ /template/ atom|CheckBoxIndicator#PART_Indicator">
|
||||
<Setter Property="Background"
|
||||
Value="{DynamicResource {x:Static atom:SharedTokenKey.ColorPrimaryHover}}" />
|
||||
<Setter Property="BorderBrush"
|
||||
Value="{DynamicResource {x:Static atom:SharedTokenKey.ColorPrimaryHover}}" />
|
||||
</Style>
|
||||
</Style>
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:not(:checked):pointerover">
|
||||
<Style Selector="^ /template/ atom|CheckBoxIndicator#PART_Indicator">
|
||||
<Setter Property="BorderBrush"
|
||||
Value="{DynamicResource {x:Static atom:SharedTokenKey.ColorPrimaryHover}}" />
|
||||
</Style>
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:indeterminate:pointerover">
|
||||
<Style Selector="^ /template/ atom|CheckBoxIndicator#PART_Indicator">
|
||||
<Setter Property="BorderBrush"
|
||||
Value="{DynamicResource {x:Static atom:SharedTokenKey.ColorPrimaryHover}}" />
|
||||
</Style>
|
||||
</Style>
|
||||
|
||||
<Style Selector="^:disabled">
|
||||
<Style Selector="^ /template/ atom|CheckBoxIndicator#PART_Indicator">
|
||||
<Setter Property="Background"
|
||||
Value="{DynamicResource {x:Static atom:SharedTokenKey.ColorBgContainerDisabled}}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static atom:SharedTokenKey.ColorBorder}}" />
|
||||
</Style>
|
||||
<Style Selector="^:checked">
|
||||
<Style Selector="^ /template/ atom|CheckBoxIndicator#PART_Indicator">
|
||||
<Setter Property="CheckedMarkBrush"
|
||||
Value="{DynamicResource {x:Static atom:SharedTokenKey.ColorTextDisabled}}" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^:indeterminate">
|
||||
<Style Selector="^ /template/ atom|CheckBoxIndicator#PART_Indicator">
|
||||
<Setter Property="TristateMarkBrush"
|
||||
Value="{DynamicResource {x:Static atom:SharedTokenKey.ColorTextDisabled}}" />
|
||||
</Style>
|
||||
</Style>
|
||||
</Style>
|
||||
|
||||
<!-- BuildIndicatorStyle 结束 -->
|
||||
|
||||
</ControlTheme>
|
||||
</ResourceDictionary>
|
||||
-1
@@ -32,7 +32,6 @@ namespace AtomUI.Theme
|
||||
themes.Add(new AtomUI.Controls.CardTabItemTheme());
|
||||
themes.Add(new AtomUI.Controls.CardTabStripItemTheme());
|
||||
themes.Add(new AtomUI.Controls.CardTabStripTheme());
|
||||
themes.Add(new AtomUI.Controls.CheckBoxTheme());
|
||||
themes.Add(new AtomUI.Controls.CircleProgressTheme());
|
||||
themes.Add(new AtomUI.Controls.CollapseItemTheme());
|
||||
themes.Add(new AtomUI.Controls.CollapseTheme());
|
||||
|
||||
@@ -76,7 +76,7 @@ public class OptionButton : AvaloniaRadioButton,
|
||||
OptionButtonPositionTrait.OnlyOne);
|
||||
|
||||
internal static readonly StyledProperty<bool> IsMotionEnabledProperty
|
||||
= WaveSpiritAwareControlProperty.IsMotionEnabledProperty.AddOwner<OptionButton>();
|
||||
= MotionAwareControlProperty.IsMotionEnabledProperty.AddOwner<OptionButton>();
|
||||
|
||||
internal static readonly StyledProperty<bool> IsWaveSpiritEnabledProperty
|
||||
= WaveSpiritAwareControlProperty.IsWaveSpiritEnabledProperty.AddOwner<OptionButton>();
|
||||
|
||||
@@ -42,7 +42,7 @@ public class OptionButtonGroup : SelectingItemsControl,
|
||||
AvaloniaProperty.Register<OptionButtonGroup, OptionButtonStyle>(nameof(SizeType));
|
||||
|
||||
public static readonly StyledProperty<bool> IsMotionEnabledProperty
|
||||
= WaveSpiritAwareControlProperty.IsMotionEnabledProperty.AddOwner<OptionButtonGroup>();
|
||||
= MotionAwareControlProperty.IsMotionEnabledProperty.AddOwner<OptionButtonGroup>();
|
||||
|
||||
public static readonly StyledProperty<bool> IsWaveSpiritEnabledProperty
|
||||
= WaveSpiritAwareControlProperty.IsWaveSpiritEnabledProperty.AddOwner<OptionButtonGroup>();
|
||||
|
||||
@@ -43,7 +43,7 @@ public abstract class AbstractPagination : TemplatedControl,
|
||||
(o, v) => o.Total = v);
|
||||
|
||||
public static readonly StyledProperty<bool> IsMotionEnabledProperty
|
||||
= WaveSpiritAwareControlProperty.IsMotionEnabledProperty.AddOwner<AbstractPagination>();
|
||||
= MotionAwareControlProperty.IsMotionEnabledProperty.AddOwner<AbstractPagination>();
|
||||
|
||||
public PaginationAlign Align
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ public class RadioButton : AvaloniaRadioButton,
|
||||
#region 公共属性定义
|
||||
|
||||
public static readonly StyledProperty<bool> IsMotionEnabledProperty
|
||||
= WaveSpiritAwareControlProperty.IsMotionEnabledProperty.AddOwner<RadioButton>();
|
||||
= MotionAwareControlProperty.IsMotionEnabledProperty.AddOwner<RadioButton>();
|
||||
|
||||
public static readonly StyledProperty<bool> IsWaveSpiritEnabledProperty
|
||||
= WaveSpiritAwareControlProperty.IsWaveSpiritEnabledProperty.AddOwner<RadioButton>();
|
||||
|
||||
@@ -119,7 +119,7 @@ internal class RadioIndicator : Control,
|
||||
#region 内部属性定义
|
||||
|
||||
internal static readonly StyledProperty<bool> IsMotionEnabledProperty
|
||||
= WaveSpiritAwareControlProperty.IsMotionEnabledProperty.AddOwner<RadioIndicator>();
|
||||
= MotionAwareControlProperty.IsMotionEnabledProperty.AddOwner<RadioIndicator>();
|
||||
|
||||
internal static readonly StyledProperty<bool> IsWaveAnimationEnabledProperty
|
||||
= WaveSpiritAwareControlProperty.IsWaveSpiritEnabledProperty.AddOwner<RadioIndicator>();
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:atom="https://atomui.net">
|
||||
<ControlTheme x:Key="{x:Type atom:RadioButton}" TargetType="atom:RadioButton">
|
||||
<Setter Property="Template">
|
||||
</Setter>
|
||||
</ControlTheme>
|
||||
</ResourceDictionary>
|
||||
@@ -134,7 +134,7 @@ public class Slider : RangeBase,
|
||||
SliderTrack.IncludedProperty.AddOwner<Slider>();
|
||||
|
||||
public static readonly StyledProperty<bool> IsMotionEnabledProperty
|
||||
= WaveSpiritAwareControlProperty.IsMotionEnabledProperty.AddOwner<Slider>();
|
||||
= MotionAwareControlProperty.IsMotionEnabledProperty.AddOwner<Slider>();
|
||||
|
||||
public static readonly StyledProperty<bool> IsWaveAnimationEnabledProperty
|
||||
= WaveSpiritAwareControlProperty.IsWaveSpiritEnabledProperty.AddOwner<Slider>();
|
||||
|
||||
@@ -59,7 +59,7 @@ public class ToggleSwitch : ToggleButton,
|
||||
AvaloniaProperty.Register<ToggleSwitch, bool>(nameof(IsLoading));
|
||||
|
||||
public static readonly StyledProperty<bool> IsMotionEnabledProperty
|
||||
= WaveSpiritAwareControlProperty.IsMotionEnabledProperty.AddOwner<ToggleSwitch>();
|
||||
= MotionAwareControlProperty.IsMotionEnabledProperty.AddOwner<ToggleSwitch>();
|
||||
|
||||
public static readonly StyledProperty<bool> IsWaveSpiritEnabledProperty
|
||||
= WaveSpiritAwareControlProperty.IsWaveSpiritEnabledProperty.AddOwner<ToggleSwitch>();
|
||||
|
||||
@@ -44,7 +44,7 @@ public class HyperLinkTextBlock : TemplatedControl, ICustomHitTest, IMotionAware
|
||||
TextBlock.TextTrimmingProperty.AddOwner<HyperLinkTextBlock>();
|
||||
|
||||
public static readonly StyledProperty<bool> IsMotionEnabledProperty
|
||||
= WaveSpiritAwareControlProperty.IsMotionEnabledProperty.AddOwner<HyperLinkTextBlock>();
|
||||
= MotionAwareControlProperty.IsMotionEnabledProperty.AddOwner<HyperLinkTextBlock>();
|
||||
|
||||
/// <summary>
|
||||
/// Defines the <see cref="Command"/> property.
|
||||
|
||||
@@ -78,7 +78,7 @@ public class ToolTip : ContentControl,
|
||||
AvaloniaProperty.RegisterAttached<ToolTip, Control, bool>("IsCustomHide");
|
||||
|
||||
public static readonly StyledProperty<bool> IsMotionEnabledProperty
|
||||
= WaveSpiritAwareControlProperty.IsMotionEnabledProperty.AddOwner<ToolTip>();
|
||||
= MotionAwareControlProperty.IsMotionEnabledProperty.AddOwner<ToolTip>();
|
||||
|
||||
public static readonly StyledProperty<bool> IsWaveSpiritEnabledProperty
|
||||
= WaveSpiritAwareControlProperty.IsWaveSpiritEnabledProperty.AddOwner<ToolTip>();
|
||||
|
||||
@@ -22,7 +22,7 @@ public static class WaveSpiritAwareControlExtensions
|
||||
{
|
||||
var compositeDisposable = new CompositeDisposable();
|
||||
compositeDisposable.Add(TokenResourceBinder.CreateTokenBinding(control,
|
||||
WaveSpiritAwareControlProperty.IsMotionEnabledProperty,
|
||||
MotionAwareControlProperty.IsMotionEnabledProperty,
|
||||
SharedTokenKey.EnableMotion));
|
||||
compositeDisposable.Add(TokenResourceBinder.CreateTokenBinding(control,
|
||||
WaveSpiritAwareControlProperty.IsWaveSpiritEnabledProperty,
|
||||
@@ -49,7 +49,7 @@ public static class WaveSpiritAwareControlExtensions
|
||||
{
|
||||
if (sender is Control hostControl)
|
||||
{
|
||||
var isMotionEnabledChanged = e.Property.Name == WaveSpiritAwareControlProperty.IsMotionEnabledPropertyName;
|
||||
var isMotionEnabledChanged = e.Property.Name == MotionAwareControlProperty.IsMotionEnabledPropertyName;
|
||||
var isWaveSpiritEnabledChanged =
|
||||
e.Property.Name == WaveSpiritAwareControlProperty.IsWaveSpiritEnabledPropertyName;
|
||||
if (isMotionEnabledChanged || isWaveSpiritEnabledChanged)
|
||||
|
||||
Reference in New Issue
Block a user