Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.UI.dll
Syntax:
public class RadToggleSwitchElement : LightVisualElement, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IBindableComponent, IComponent, IDisposable, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode, IPrimitiveElement, IShapedElement, IFillElement, IBorderElement, IBoxStyle, IBoxElement, IDrawFillElement, IImageElement, ITextPrimitive, ITextProvider
Inheritance: objectDisposableObjectRadObjectRadElementVisualElementRadComponentElementRadItemUIItemBaseLightVisualElementRadToggleSwitchElement...
Implements:
Inherited Members
Constructors
public RadToggleSwitchElement()
Fields
Identifies the IsOn dependency property.
public static RadProperty IsOnProperty
Identifies the ThumbOffset dependency property.
public static RadProperty ThumbOffsetProperty
Identifies the ThumbTickness dependency property.
public static RadProperty ThumbTicknessProperty
Properties
Gets or sets a value indicating whether animation effects are used when the toggle switch changes state.
public bool AllowAnimation { get; set; }
Gets or sets the total number of animation frames used during state transitions.
public int AnimationFrames { get; set; }
Gets or sets the time interval in milliseconds between animation frames during state transitions.
public int AnimationInterval { get; set; }
Gets or sets the size of the drag threshold area that determines when a mouse operation is considered a drag versus a click.
public int DragSize { get; set; }
Gets a value indicating whether the toggle switch is currently performing an animation transition.
[Browsable(false)]
public bool IsAnimating { get; set; }
Gets a value indicating whether the toggle switch is currently in the "On" state.
public bool IsOn { get; }
Gets the visual element that represents the "Off" state of the toggle switch.
public ToggleSwitchPartElement OffElement { get; protected set; }
Gets or sets the text displayed on the toggle switch when it is in the "Off" state.
public string OffText { get; set; }
Gets the visual element that represents the "On" state of the toggle switch.
public ToggleSwitchPartElement OnElement { get; protected set; }
Gets or sets the text displayed on the toggle switch when it is in the "On" state.
public string OnText { get; set; }
Gets or sets a value indicating whether the toggle switch value can be modified by user interaction.
public bool ReadOnly { get; set; }
Gets or sets the elasticity factor that determines how far the thumb must be dragged before the switch changes state.
public double SwitchElasticity { get; set; }
Gets the movable thumb element that indicates the current state of the toggle switch.
public ToggleSwitchThumbElement Thumb { get; protected set; }
Gets or sets the horizontal offset position of the thumb element within the toggle switch.
public int ThumbOffset { get; set; }
Gets or sets the width of the thumb element in pixels.
[VsbBrowsable(true)]
public int ThumbTickness { get; set; }
Gets or sets the mode that determines how the toggle switch responds to mouse interactions such as clicks and drag operations.
public ToggleStateMode ToggleStateMode { get; set; }
Methods
Cancels the currently running animation.
public void CancelAnimation()
Creates and initializes the child elements that make up the toggle switch visual structure.
protected override void CreateChildElements()
Overrides:
Creates and returns a new instance of a toggle switch part element.
protected virtual ToggleSwitchPartElement CreatePartElement()
A new ToggleSwitchPartElement instance.
Creates and returns a new instance of the thumb element used for user interaction.
protected virtual ToggleSwitchThumbElement CreateThumbElement()
A new ToggleSwitchThumbElement instance.
Releases the managed resources used by the RadToggleSwitchElement.
protected override void DisposeManagedResources()
Overrides:
protected override RectangleF GetClientRectangle(SizeF finalSize)
Overrides:
Calculates the clipping rectangle for this element, taking into account border thickness and padding.
protected override RectangleF GetClipRect()
A RectangleF representing the clipping bounds for content rendering.
Overrides:
Initializes the default field values for the RadToggleSwitchElement.
protected override void InitializeFields()
Overrides:
protected virtual void OnAnimationFinished(AnimationStatusEventArgs e)
protected virtual void OnAnimationStarted(AnimationStatusEventArgs e)
Raises the KeyDown event.
protected override void OnKeyDown(KeyEventArgs e)
The key event arguments.
Overrides:
Called when a mouse button is pressed down over the item.
protected override void OnMouseDown(MouseEventArgs e)
The mouse event arguments.
Overrides:
Called when the mouse moves over the item, handling highlight and border highlight effects.
protected override void OnMouseMove(MouseEventArgs e)
The mouse event arguments.
Overrides:
Called when a mouse button is released over the item.
protected override void OnMouseUp(MouseEventArgs e)
The mouse event arguments.
Overrides:
protected virtual void OnValueChanged()
protected virtual void OnValueChanging(ValueChangingEventArgs e)
Renders the border of the element using the specified graphics context, rotation angle, and scaling factor.
protected override void PaintBorder(IGraphics graphics, float angle, SizeF scale)
The graphics context used for painting operations.
anglefloatThe rotation angle in degrees to apply during painting.
scaleSizeFThe scaling factors to apply for width and height during painting.
Overrides:
protected virtual void ProcessAnimation()
Sets the value of RadToggleSwitch.
Toggles the value of RadToggleSwitch
public void Toggle()
Toggles the value of RadToggleSwitch
Events
Occurs when an animation transition completes.
public event AnimationFinishedEventHandler AnimationFinished
Occurs when an animation transition starts.
public event AnimationStartedEventHandler AnimationStarted
Occurs after the value of the toggle switch has changed.
public event EventHandler ValueChanged
Occurs before the value of the toggle switch changes and allows the change to be cancelled.
public event ValueChangingEventHandler ValueChanging