diff --git a/src/Wpf.Ui.Gallery/Views/Pages/BasicInput/ToggleSwitchPage.xaml b/src/Wpf.Ui.Gallery/Views/Pages/BasicInput/ToggleSwitchPage.xaml index 25d54c574..f3aaeb6b0 100644 --- a/src/Wpf.Ui.Gallery/Views/Pages/BasicInput/ToggleSwitchPage.xaml +++ b/src/Wpf.Ui.Gallery/Views/Pages/BasicInput/ToggleSwitchPage.xaml @@ -29,15 +29,31 @@ - - + + + + + + + + + + + + + + + diff --git a/src/Wpf.Ui/Controls/ToggleSwitch/ToggleSwitch.cs b/src/Wpf.Ui/Controls/ToggleSwitch/ToggleSwitch.cs index 026b544c1..f0c10ff23 100644 --- a/src/Wpf.Ui/Controls/ToggleSwitch/ToggleSwitch.cs +++ b/src/Wpf.Ui/Controls/ToggleSwitch/ToggleSwitch.cs @@ -3,12 +3,50 @@ // Copyright (C) Leszek Pomianowski and WPF UI Contributors. // All Rights Reserved. -// ReSharper disable once CheckNamespace +using System.ComponentModel; +using System.Drawing; +using System.Windows; + namespace Wpf.Ui.Controls; /// /// Use to present users with two mutally exclusive options (like on/off). /// -//[ToolboxItem(true)] -//[ToolboxBitmap(typeof(ToggleSwitch), "ToggleSwitch.bmp")] -public class ToggleSwitch : System.Windows.Controls.Primitives.ToggleButton { } +// [ToolboxItem(true)] +// [ToolboxBitmap(typeof(ToggleSwitch), "ToggleSwitch.bmp")] +public class ToggleSwitch : System.Windows.Controls.Primitives.ToggleButton +{ + /// + /// Property for . + /// + public static readonly DependencyProperty OffContentProperty = DependencyProperty.Register( + "OffContent", typeof(object), typeof(ToggleSwitch), new PropertyMetadata(null)); + + /// + /// Property for . + /// + public static readonly DependencyProperty OnContentProperty = DependencyProperty.Register( + "OnContent", typeof(object), typeof(ToggleSwitch), new PropertyMetadata(null)); + + /// + /// Provides the object content that should be displayed when this + /// has state of "Off". + /// + [Bindable(true)] + public object OffContent + { + get => GetValue(OffContentProperty); + set => SetValue(OffContentProperty, value); + } + + /// + /// Provides the object content that should be displayed when this + /// has state of "On". + /// + [Bindable(true)] + public object OnContent + { + get => GetValue(OnContentProperty); + set => SetValue(OnContentProperty, value); + } +} diff --git a/src/Wpf.Ui/Controls/ToggleSwitch/ToggleSwitch.xaml b/src/Wpf.Ui/Controls/ToggleSwitch/ToggleSwitch.xaml index 16add91d3..267ff6c66 100644 --- a/src/Wpf.Ui/Controls/ToggleSwitch/ToggleSwitch.xaml +++ b/src/Wpf.Ui/Controls/ToggleSwitch/ToggleSwitch.xaml @@ -127,12 +127,24 @@ TextElement.Foreground="{TemplateBinding Foreground}" /> - + + + + + + - - + + + + + + + + - + + @@ -219,6 +231,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +