ClassRadToggleSwitchElement
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
RadToggleSwitchElement()
Declaration
public RadToggleSwitchElement()
Fields
IsOnProperty
Identifies the IsOn dependency property.
ThumbOffsetProperty
Identifies the ThumbOffset dependency property.
ThumbTicknessProperty
Identifies the ThumbTickness dependency property.
Declaration
public static RadProperty ThumbTicknessProperty
Field Value
Properties
AllowAnimation
Gets or sets a value indicating whether animation effects are used when the toggle switch changes state.
AnimationFrames
Gets or sets the total number of animation frames used during state transitions.
AnimationInterval
Gets or sets the time interval in milliseconds between animation frames during state transitions.
DragSize
Gets or sets the size of the drag threshold area that determines when a mouse operation is considered a drag versus a click.
IsAnimating
Gets a value indicating whether the toggle switch is currently performing an animation transition.
Declaration
[Browsable(false)]
public bool IsAnimating { get; set; }
Property Value
IsOn
Gets a value indicating whether the toggle switch is currently in the "On" state.
OffElement
Gets the visual element that represents the "Off" state of the toggle switch.
Declaration
public ToggleSwitchPartElement OffElement { get; protected set; }
Property Value
OffText
Gets or sets the text displayed on the toggle switch when it is in the "Off" state.
OnElement
Gets the visual element that represents the "On" state of the toggle switch.
Declaration
public ToggleSwitchPartElement OnElement { get; protected set; }
Property Value
OnText
Gets or sets the text displayed on the toggle switch when it is in the "On" state.
ReadOnly
Gets or sets a value indicating whether the toggle switch value can be modified by user interaction.
SwitchElasticity
Gets or sets the elasticity factor that determines how far the thumb must be dragged before the switch changes state.
Thumb
Gets the movable thumb element that indicates the current state of the toggle switch.
Declaration
public ToggleSwitchThumbElement Thumb { get; protected set; }
Property Value
ThumbOffset
Gets or sets the horizontal offset position of the thumb element within the toggle switch.
ThumbTickness
Gets or sets the width of the thumb element in pixels.
Declaration
[VsbBrowsable(true)]
public int ThumbTickness { get; set; }
Property Value
ToggleStateMode
Gets or sets the mode that determines how the toggle switch responds to mouse interactions such as clicks and drag operations.
Declaration
public ToggleStateMode ToggleStateMode { get; set; }
Property Value
Methods
ArrangeOverride(SizeF)
Arranges the child elements within the specified final size bounds.
CancelAnimation()
Cancels the currently running animation.
Declaration
public void CancelAnimation()
CreateChildElements()
Creates and initializes the child elements that make up the toggle switch visual structure.
Declaration
protected override void CreateChildElements()
Overrides
CreatePartElement()
Creates and returns a new instance of a toggle switch part element.
Declaration
protected virtual ToggleSwitchPartElement CreatePartElement()
Returns
A new ToggleSwitchPartElement instance.
CreateThumbElement()
Creates and returns a new instance of the thumb element used for user interaction.
Declaration
protected virtual ToggleSwitchThumbElement CreateThumbElement()
Returns
A new ToggleSwitchThumbElement instance.
DisposeManagedResources()
Releases the managed resources used by the RadToggleSwitchElement.
Declaration
protected override void DisposeManagedResources()
Overrides
GetClientRectangle(SizeF)
Declaration
protected override RectangleF GetClientRectangle(SizeF finalSize)
Parameters
finalSize
Returns
Overrides
GetClipRect()
Calculates the clipping rectangle for this element, taking into account border thickness and padding.
Declaration
protected override RectangleF GetClipRect()
Returns
A RectangleF representing the clipping bounds for content rendering.
Overrides
InitializeFields()
Initializes the default field values for the RadToggleSwitchElement.
Declaration
protected override void InitializeFields()
Overrides
OnAnimationFinished(AnimationStatusEventArgs)
Declaration
protected virtual void OnAnimationFinished(AnimationStatusEventArgs e)
Parameters
e
OnAnimationStarted(AnimationStatusEventArgs)
Declaration
protected virtual void OnAnimationStarted(AnimationStatusEventArgs e)
Parameters
e
OnKeyDown(KeyEventArgs)
Raises the KeyDown event.
Declaration
protected override void OnKeyDown(KeyEventArgs e)
Parameters
e
The key event arguments.
Overrides
OnMouseDown(MouseEventArgs)
Called when a mouse button is pressed down over the item.
Declaration
protected override void OnMouseDown(MouseEventArgs e)
Parameters
e
The mouse event arguments.
Overrides
OnMouseMove(MouseEventArgs)
Called when the mouse moves over the item, handling highlight and border highlight effects.
Declaration
protected override void OnMouseMove(MouseEventArgs e)
Parameters
e
The mouse event arguments.
Overrides
OnMouseUp(MouseEventArgs)
Called when a mouse button is released over the item.
Declaration
protected override void OnMouseUp(MouseEventArgs e)
Parameters
e
The mouse event arguments.
Overrides
OnValueChanged()
Declaration
protected virtual void OnValueChanged()
OnValueChanging(ValueChangingEventArgs)
Declaration
protected virtual void OnValueChanging(ValueChangingEventArgs e)
Parameters
e
PaintBorder(IGraphics, float, SizeF)
Renders the border of the element using the specified graphics context, rotation angle, and scaling factor.
Declaration
protected override void PaintBorder(IGraphics graphics, float angle, SizeF scale)
Parameters
graphics
The graphics context used for painting operations.
angle
The rotation angle in degrees to apply during painting.
scale
The scaling factors to apply for width and height during painting.
Overrides
ProcessAnimation()
Declaration
protected virtual void ProcessAnimation()
SetToggleState(bool)
Sets the value of RadToggleSwitch.
Declaration
public void SetToggleState(bool newValue)
Parameters
newValue
The new value.
SetToggleState(bool, bool)
Sets the value of RadToggleSwitch.
Toggle(bool)
Toggles the value of RadToggleSwitch
Declaration
public void Toggle(bool animate)
Parameters
animate
Indicates whether to use animation.
Events
AnimationFinished
Occurs when an animation transition completes.
Declaration
public event AnimationFinishedEventHandler AnimationFinished
Event Value
AnimationStarted
Occurs when an animation transition starts.
Declaration
public event AnimationStartedEventHandler AnimationStarted
Event Value
ValueChanged
Occurs after the value of the toggle switch has changed.
ValueChanging
Occurs before the value of the toggle switch changes and allows the change to be cancelled.
Declaration
public event ValueChangingEventHandler ValueChanging
Event Value