FlipSwitch Class
Represents a flip switch control.
public class FlipSwitch : CircularGaugeBase, ILogicalParent, IVisualParent
- Inheritance:
- object Visual UIElement FrameworkElement GaugeElement GaugeBase CircularGaugeBase object
- Implements:
- ILogicalParent IVisualParent
Constructors
FlipSwitch()
Initializes an instance of the class.
public FlipSwitch()
Properties
BallBrush
The brush used to render the ball of the switch.
BaseAccentBrush
The brush used to render the accent shape on the base.
BaseBackground
The brush used to render the base background.
FocusBrush
The brush used to render the focus indicator.
FocusExtent
The extent of the focus indicator.
IsChecked
Whether the FlipSwitch is checked.
public bool? IsChecked { get; set; }
Property Value
- bool?:
trueif the FlipSwitch is checked;falseif the FlipSwitch is unchecked; otherwisenull. The default value isfalse.
IsSwitchEffectEnabled
Indicates whether a special effect should be rendered for the switch.
IsThreeState
Whether the control supports two or three states.
RenderedFocused
Indicates whether the switch should be rendered with a focus indicator.
ShaftBrush
The brush used to render the shaft of the switch.
SwitchInterval
The interval that it takes the switch to travel to a new location.
public Duration SwitchInterval { get; set; }
Property Value
- Duration:
The default value is
250milliseconds.
SwitchOffset
The offset of the switch, which is used to move it up and down.
SwitchRadiusRatio
The radius of the switch as a ratio of the Radius property.
SwitchType
The type of switch rendered.
public FlipSwitchType SwitchType { get; set; }
Property Value
- FlipSwitchType:
The default value is Circular.
TipBrush
The brush used to render the tip of the switch.
Methods
OnChecked(RoutedEventArgs)
Raises the Checked event.
protected virtual void OnChecked(RoutedEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | RoutedEventArgs | The RoutedEventArgs instance containing the event data. |
OnCreateAutomationPeer()
Returns class-specific AutomationPeer implementations for the Windows Presentation Foundation (WPF) infrastructure.
protected override AutomationPeer? OnCreateAutomationPeer()
Returns
- AutomationPeer:
The type-specific AutomationPeer implementation.
OnIndeterminate(RoutedEventArgs)
Raises the Indeterminate event.
protected virtual void OnIndeterminate(RoutedEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | RoutedEventArgs | The RoutedEventArgs instance containing the event data. |
OnMouseDown(MouseButtonEventArgs)
Invoked when an unhandled System.Windows.Input.Mouse.MouseDown attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
protected override void OnMouseDown(MouseButtonEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | MouseButtonEventArgs | The MouseButtonEventArgs that contains the event data. This event data reports details about the mouse button that was pressed and the handled state. |
OnRender(DrawingContext)
When overridden in a derived class, participates in rendering operations that are directed by the layout system. The rendering instructions for this element are not used directly when this method is invoked, and are instead preserved for later asynchronous use by layout and drawing.
protected override void OnRender(DrawingContext drawingContext)
| Parameter | Type | Description |
|---|---|---|
| drawingContext | DrawingContext | The drawing instructions for a specific element. This context is provided to the layout system. |
OnToggle()
Called by the OnClick method to implement toggle behavior.
OnUnchecked(RoutedEventArgs)
Raises the Unchecked event.
protected virtual void OnUnchecked(RoutedEventArgs e)
| Parameter | Type | Description |
|---|---|---|
| e | RoutedEventArgs | The RoutedEventArgs instance containing the event data. |
RenderFlipSwitch(DrawingContext)
Renders the switch based on various properties.
protected virtual void RenderFlipSwitch(DrawingContext drawingContext)
| Parameter | Type | Description |
|---|---|---|
| drawingContext | DrawingContext | The drawing context. |
UpdateSwitchOffset()
Updates the SwitchOffset, usually with an animation.
protected virtual void UpdateSwitchOffset()
Events
Checked
Occurs when the IsChecked property is changed to true.
Indeterminate
Occurs when the IsChecked property is changed to null.
Unchecked
Occurs when the IsChecked property is changed to false.
Fields
BallBrushProperty
Defines the BallBrush property.
public static readonly DependencyProperty BallBrushProperty
BaseAccentBrushProperty
Defines the BaseAccentBrush property.
public static readonly DependencyProperty BaseAccentBrushProperty
BaseBackgroundProperty
Defines the BaseBackground property.
public static readonly DependencyProperty BaseBackgroundProperty
CheckedEvent
Defines the Checked routed event.
public static readonly RoutedEvent CheckedEvent
FocusBrushProperty
Defines the FocusBrush property.
public static readonly DependencyProperty FocusBrushProperty
FocusExtentProperty
Defines the FocusExtent property.
public static readonly DependencyProperty FocusExtentProperty
IndeterminateEvent
Defines the Indeterminate routed event.
public static readonly RoutedEvent IndeterminateEvent
IsCheckedProperty
Defines the IsChecked property.
public static readonly DependencyProperty IsCheckedProperty
IsSwitchEffectEnabledProperty
Defines the IsSwitchEffectEnabled property.
public static readonly DependencyProperty IsSwitchEffectEnabledProperty
IsThreeStateProperty
Defines the IsThreeState property.
public static readonly DependencyProperty IsThreeStateProperty
RenderedFocusedProperty
Defines the RenderedFocused property.
protected static readonly DependencyProperty RenderedFocusedProperty
ShaftBrushProperty
Defines the ShaftBrush property.
public static readonly DependencyProperty ShaftBrushProperty
SwitchIntervalProperty
Defines the SwitchInterval property.
public static readonly DependencyProperty SwitchIntervalProperty
SwitchOffsetProperty
Defines the SwitchOffset property.
protected static readonly DependencyProperty SwitchOffsetProperty
SwitchRadiusRatioProperty
Defines the SwitchRadiusRatio property.
public static readonly DependencyProperty SwitchRadiusRatioProperty
SwitchTypeProperty
Defines the SwitchType property.
public static readonly DependencyProperty SwitchTypeProperty
TipBrushProperty
Defines the TipBrush property.
public static readonly DependencyProperty TipBrushProperty
UncheckedEvent
Defines the Unchecked routed event.
public static readonly RoutedEvent UncheckedEvent
Inherited Members
- CircularGaugeBase.BackgroundGeometryProperty
- CircularGaugeBase.BackgroundImageSourceProperty
- CircularGaugeBase.BackgroundRadiusRatioProperty
- CircularGaugeBase.BackgroundTypeProperty
- CircularGaugeBase.FrameTypeProperty
- CircularGaugeBase.GlassTypeProperty
- CircularGaugeBase.RadiusProperty
- CircularGaugeBase.RimGeometryProperty
- CircularGaugeBase.RimImageSourceProperty
- CircularGaugeBase.RimTypeProperty
- CircularGaugeBase.ArrangeOverride(Size)
- CircularGaugeBase.MeasureOverride(Size)
- CircularGaugeBase.GetRadius(DependencyObject)
- CircularGaugeBase.SetRadius(DependencyObject, Unit)
- CircularGaugeBase.RenderFrameBackground(DrawingContext)
- CircularGaugeBase.RenderFrameRim(DrawingContext)
- CircularGaugeBase.UpdateUnitBases()
- CircularGaugeBase.BackgroundGeometry
- CircularGaugeBase.BackgroundImageSource
- CircularGaugeBase.BackgroundRadiusRatio
- CircularGaugeBase.BackgroundType
- CircularGaugeBase.FrameType
- CircularGaugeBase.GlassType
- CircularGaugeBase.LogicalChildren
- CircularGaugeBase.Radius
- CircularGaugeBase.RimGeometry
- CircularGaugeBase.RimImageSource
- CircularGaugeBase.RimType
- GaugeBase.BackgroundProperty
- GaugeBase.IsBackgroundEffectEnabledProperty
- GaugeBase.IsRimEffectEnabledProperty
- GaugeBase.OriginProperty
- GaugeBase.RimBrushProperty
- GaugeBase.UnitBaseXProperty
- GaugeBase.UnitBaseYProperty
- GaugeBase.XProperty
- GaugeBase.YProperty
- GaugeBase.GetLocation(UIElement, Size)
- GaugeBase.OnRenderSizeChanged(SizeChangedInfo)
- GaugeBase.GetOrigin(DependencyObject)
- GaugeBase.SetOrigin(DependencyObject, CoordinateOrigin)
- GaugeBase.ToBitmap(double, double)
- GaugeBase.GetX(DependencyObject)
- GaugeBase.SetX(DependencyObject, Unit)
- GaugeBase.GetY(DependencyObject)
- GaugeBase.SetY(DependencyObject, Unit)
- GaugeBase.Background
- GaugeBase.IsBackgroundEffectEnabled
- GaugeBase.IsRimEffectEnabled
- GaugeBase.Items
- GaugeBase.Origin
- GaugeBase.RimBrush
- GaugeBase.UnitBaseX
- GaugeBase.UnitBaseY
- GaugeBase.X
- GaugeBase.Y
- GaugeElement.ZIndexProperty
- GaugeElement.GetVisualChild(int)
- GaugeElement.GetZIndex(UIElement)
- GaugeElement.SetZIndex(UIElement, int)
- GaugeElement.VisualChildren
- GaugeElement.VisualChildrenCount
- GaugeElement.ZIndex