diff --git a/src/Avalonia.Controls/ToggleSwitch.cs b/src/Avalonia.Controls/ToggleSwitch.cs index 79638dce74..ad35c43d87 100644 --- a/src/Avalonia.Controls/ToggleSwitch.cs +++ b/src/Avalonia.Controls/ToggleSwitch.cs @@ -8,31 +8,52 @@ using Avalonia.LogicalTree; namespace Avalonia.Controls { /// - /// A WinUi like ToggleSwitch control. + /// A Toggle Switch control. /// - /// - public class ToggleSwitch : ToggleButton { + static ToggleSwitch() + { + OffContentProperty.Changed.AddClassHandler((x, e) => x.OffContentChanged(e)); + OnContentProperty.Changed.AddClassHandler((x, e) => x.OnContentChanged(e)); + } + + /// + /// Defines the property. + /// public static readonly StyledProperty OffContentProperty = - AvaloniaProperty.Register(nameof(OffContent), defaultValue:"Off"); + AvaloniaProperty.Register(nameof(OffContent), defaultValue: "Off"); + /// + /// Defines the property. + /// public static readonly StyledProperty OffContentTemplateProperty = AvaloniaProperty.Register(nameof(OffContentTemplate)); - + /// + /// Defines the property. + /// public static readonly StyledProperty OnContentProperty = - AvaloniaProperty.Register(nameof(OnContent), defaultValue: "On"); + AvaloniaProperty.Register(nameof(OnContent), defaultValue: "On"); + /// + /// Defines the property. + /// public static readonly StyledProperty OnContentTemplateProperty = AvaloniaProperty.Register(nameof(OnContentTemplate)); + /// + /// Gets or Sets the Content that is displayed when in the On State. + /// public object OnContent { get { return GetValue(OnContentProperty); } set { SetValue(OnContentProperty, value); } } + /// + /// Gets or Sets the Content that is displayed when in the Off State. + /// public object OffContent { get { return GetValue(OffContentProperty); } @@ -51,13 +72,18 @@ namespace Avalonia.Controls private set; } - + /// + /// Gets or Sets the used to display the . + /// public IDataTemplate OffContentTemplate { get { return GetValue(OffContentTemplateProperty); } set { SetValue(OffContentTemplateProperty, value); } } + /// + /// Gets or Sets the used to display the . + /// public IDataTemplate OnContentTemplate { get { return GetValue(OnContentTemplateProperty); } @@ -90,13 +116,6 @@ namespace Avalonia.Controls } } - static ToggleSwitch() - { - OffContentProperty.Changed.AddClassHandler((x, e) => x.OffContentChanged(e)); - OnContentProperty.Changed.AddClassHandler((x, e) => x.OnContentChanged(e)); - } - - protected override bool RegisterContentPresenter(IContentPresenter presenter) { var result = base.RegisterContentPresenter(presenter); @@ -114,6 +133,6 @@ namespace Avalonia.Controls return result; } - } + } }