Class ToggleSwitch
A Toggle Switch control.
[TemplatePart("PART_MovingKnobs", typeof(Panel), IsRequired = true)]
[TemplatePart("PART_OffContentPresenter", typeof(ContentPresenter))]
[TemplatePart("PART_OnContentPresenter", typeof(ContentPresenter))]
[TemplatePart("PART_SwitchKnob", typeof(Panel))]
[PseudoClasses(new string[] { ":dragging" })]
public class ToggleSwitch : ToggleButton, INotifyPropertyChanged, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, IStyleable, INamed, IInputElement, IDataTemplateHost, ISetterValue, ICommandSource
- Inheritance
-
ToggleSwitch
- Implements
- Inherited Members
- Extension Methods
Constructors
ToggleSwitch()
public ToggleSwitch()
Fields
KnobTransitionsProperty
Defines the KnobTransitions property.
public static readonly StyledProperty<Transitions> KnobTransitionsProperty
Field Value
OffContentProperty
Defines the OffContent property.
public static readonly StyledProperty<object?> OffContentProperty
Field Value
OffContentTemplateProperty
Defines the OffContentTemplate property.
public static readonly StyledProperty<IDataTemplate?> OffContentTemplateProperty
Field Value
OnContentProperty
Defines the OnContent property.
public static readonly StyledProperty<object?> OnContentProperty
Field Value
OnContentTemplateProperty
Defines the OnContentTemplate property.
public static readonly StyledProperty<IDataTemplate?> OnContentTemplateProperty
Field Value
Properties
KnobTransitions
Gets or Sets the Transitions of switching knob.
public Transitions KnobTransitions { get; set; }
Property Value
OffContent
Gets or Sets the Content that is displayed when in the Off State.
public object? OffContent { get; set; }
Property Value
OffContentPresenter
public ContentPresenter? OffContentPresenter { get; }
Property Value
OffContentTemplate
Gets or Sets the IDataTemplate used to display the OffContent.
public IDataTemplate? OffContentTemplate { get; set; }
Property Value
OnContent
Gets or Sets the Content that is displayed when in the On State.
public object? OnContent { get; set; }
Property Value
OnContentPresenter
public ContentPresenter? OnContentPresenter { get; }
Property Value
OnContentTemplate
Gets or Sets the IDataTemplate used to display the OnContent.
public IDataTemplate? OnContentTemplate { get; set; }
Property Value
Methods
OnApplyTemplate(TemplateAppliedEventArgs)
Called when the control's template is applied. In simple terms, this means the method is called just before the control is displayed.
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
Parameters
e
TemplateAppliedEventArgsThe event args.
OnLoaded(RoutedEventArgs)
Invoked just before the Loaded event.
protected override void OnLoaded(RoutedEventArgs e)
Parameters
e
RoutedEventArgsThe event args.
RegisterContentPresenter(ContentPresenter)
Called when an ContentPresenter is registered with the control.
protected override bool RegisterContentPresenter(ContentPresenter presenter)
Parameters
presenter
ContentPresenterThe presenter.