ToggleButton class

Applies to Windows and Windows Phone

Base class for controls that can switch states, such as CheckBox and RadioButton.

Inheritance

Object
  DependencyObject
    UIElement
      FrameworkElement
        Control
          ContentControl
            ButtonBase
              ToggleButton

Syntax


public ref class ToggleButton : ButtonBase


<ToggleButton .../>
-or-
<ToggleButton>
    singleObject
</ToggleButton>
-or-
<ToggleButton>contentString</ToggleButton>

XAML Values

singleObject

A single object element that declares the content.

contentString

A string that is displayed as content, using the presenter settings in the default template ContentPresenter.

Attributes

[MarshalingBehavior(Agile)]
[Threading(Both)]
[Version(0x06020000)]
[WebHostHidden()]

Members

The ToggleButton class has these types of members:

Constructors

The ToggleButton class has these constructors.

ConstructorDescription
ToggleButton

 

Events

The ToggleButton class has these events.

EventDescription
Checked
Click (Inherited from ButtonBase)
DataContextChanged (Inherited from FrameworkElement)
DoubleTapped (Inherited from UIElement)
DragEnter (Inherited from UIElement)
DragLeave (Inherited from UIElement)
DragOver (Inherited from UIElement)
Drop (Inherited from UIElement)
GotFocus (Inherited from UIElement)
Holding (Inherited from UIElement)
Indeterminate
IsEnabledChanged (Inherited from Control)
KeyDown (Inherited from UIElement)
KeyUp (Inherited from UIElement)
LayoutUpdated (Inherited from FrameworkElement)
Loaded (Inherited from FrameworkElement)
LostFocus (Inherited from UIElement)
ManipulationCompleted (Inherited from UIElement)
ManipulationDelta (Inherited from UIElement)
ManipulationInertiaStarting (Inherited from UIElement)
ManipulationStarted (Inherited from UIElement)
ManipulationStarting (Inherited from UIElement)
PointerCanceled (Inherited from UIElement)
PointerCaptureLost (Inherited from UIElement)
PointerEntered (Inherited from UIElement)
PointerExited (Inherited from UIElement)
PointerMoved (Inherited from UIElement)
PointerPressed (Inherited from UIElement)
PointerReleased (Inherited from UIElement)
PointerWheelChanged (Inherited from UIElement)
RightTapped (Inherited from UIElement)
SizeChanged (Inherited from FrameworkElement)
Tapped (Inherited from UIElement)
Unchecked
Unloaded (Inherited from FrameworkElement)

 

Methods

The ToggleButton class has these methods. It also inherits methods from the Object class.

MethodDescription
AddHandler (Inherited from UIElement)
ApplyTemplate (Inherited from Control)
Arrange (Inherited from UIElement)
ArrangeOverride (Inherited from FrameworkElement)
CancelDirectManipulations (Inherited from UIElement)
CapturePointer (Inherited from UIElement)
ClearValue (Inherited from DependencyObject)
FindName (Inherited from FrameworkElement)
FindSubElementsForTouchTargeting (Inherited from UIElement)
Focus (Inherited from Control)
GetAnimationBaseValue (Inherited from DependencyObject)
GetBindingExpression (Inherited from FrameworkElement)
GetTemplateChild (Inherited from Control)
GetValue (Inherited from DependencyObject)
GoToElementStateCore (Inherited from FrameworkElement)
InvalidateArrange (Inherited from UIElement)
InvalidateMeasure (Inherited from UIElement)
Measure (Inherited from UIElement)
MeasureOverride (Inherited from FrameworkElement)
OnApplyTemplate (Inherited from FrameworkElement)
OnContentChanged (Inherited from ContentControl)
OnContentTemplateChanged (Inherited from ContentControl)
OnContentTemplateSelectorChanged (Inherited from ContentControl)
OnCreateAutomationPeer (Inherited from UIElement)
OnDisconnectVisualChildren (Inherited from UIElement)
OnDoubleTapped (Inherited from Control)
OnDragEnter (Inherited from Control)
OnDragLeave (Inherited from Control)
OnDragOver (Inherited from Control)
OnDrop (Inherited from Control)
OnGotFocus (Inherited from Control)
OnHolding (Inherited from Control)
OnKeyDown (Inherited from Control)
OnKeyUp (Inherited from Control)
OnLostFocus (Inherited from Control)
OnManipulationCompleted (Inherited from Control)
OnManipulationDelta (Inherited from Control)
OnManipulationInertiaStarting (Inherited from Control)
OnManipulationStarted (Inherited from Control)
OnManipulationStarting (Inherited from Control)
OnPointerCanceled (Inherited from Control)
OnPointerCaptureLost (Inherited from Control)
OnPointerEntered (Inherited from Control)
OnPointerExited (Inherited from Control)
OnPointerMoved (Inherited from Control)
OnPointerPressed (Inherited from Control)
OnPointerReleased (Inherited from Control)
OnPointerWheelChanged (Inherited from Control)
OnRightTapped (Inherited from Control)
OnTapped (Inherited from Control)
OnToggle
ReadLocalValue (Inherited from DependencyObject)
ReleasePointerCapture (Inherited from UIElement)
ReleasePointerCaptures (Inherited from UIElement)
RemoveHandler (Inherited from UIElement)
SetBinding (Inherited from FrameworkElement)
SetValue (Inherited from DependencyObject)
TransformToVisual (Inherited from UIElement)
UpdateLayout (Inherited from UIElement)

 

Properties

The ToggleButton class has these properties.

PropertyAccess typeDescription

ActualHeight

Read-only (Inherited from FrameworkElement)

ActualWidth

Read-only (Inherited from FrameworkElement)

AllowDrop

Read/write (Inherited from UIElement)

Background

Read/write (Inherited from Control)

BaseUri

Read-only (Inherited from FrameworkElement)

BorderBrush

Read/write (Inherited from Control)

BorderThickness

Read/write (Inherited from Control)

CacheMode

Read/write (Inherited from UIElement)

CharacterSpacing

Read/write (Inherited from Control)

ClickMode

Read/write (Inherited from ButtonBase)

Clip

Read/write (Inherited from UIElement)

Command

Read/write (Inherited from ButtonBase)

CommandParameter

Read/write (Inherited from ButtonBase)

CompositeMode

Read/write (Inherited from UIElement)

Content

Read/write (Inherited from ContentControl)

ContentTemplate

Read/write (Inherited from ContentControl)

ContentTemplateRoot

Read-only (Inherited from ContentControl)

ContentTemplateSelector

Read/write (Inherited from ContentControl)

ContentTransitions

Read/write (Inherited from ContentControl)

DataContext

Read/write (Inherited from FrameworkElement)

DefaultStyleKey

Read/write (Inherited from Control)

DesiredSize

Read-only (Inherited from UIElement)

Dispatcher

Read-only (Inherited from DependencyObject)

FlowDirection

Read/write (Inherited from FrameworkElement)

FocusState

Read-only (Inherited from Control)

FontFamily

Read/write (Inherited from Control)

FontSize

Read/write (Inherited from Control)

FontStretch

Read/write (Inherited from Control)

FontStyle

Read/write (Inherited from Control)

FontWeight

Read/write (Inherited from Control)

Foreground

Read/write (Inherited from Control)

Height

Read/write (Inherited from FrameworkElement)

HorizontalAlignment

Read/write (Inherited from FrameworkElement)

HorizontalContentAlignment

Read/write (Inherited from Control)

IsChecked

Read/write

IsCheckedProperty

Read-only

IsDoubleTapEnabled

Read/write (Inherited from UIElement)

IsEnabled

Read/write (Inherited from Control)

IsHitTestVisible

Read/write (Inherited from UIElement)

IsHoldingEnabled

Read/write (Inherited from UIElement)

IsPointerOver

Read-only (Inherited from ButtonBase)

IsPressed

Read-only (Inherited from ButtonBase)

IsRightTapEnabled

Read/write (Inherited from UIElement)

IsTabStop

Read/write (Inherited from Control)

IsTapEnabled

Read/write (Inherited from UIElement)

IsThreeState

Read/write

IsThreeStateProperty

Read-only

Language

Read/write (Inherited from FrameworkElement)

ManipulationMode

Read/write (Inherited from UIElement)

Margin

Read/write (Inherited from FrameworkElement)

MaxHeight

Read/write (Inherited from FrameworkElement)

MaxWidth

Read/write (Inherited from FrameworkElement)

MinHeight

Read/write (Inherited from FrameworkElement)

MinWidth

Read/write (Inherited from FrameworkElement)

Name

Read/write (Inherited from FrameworkElement)

Opacity

Read/write (Inherited from UIElement)

Padding

Read/write (Inherited from Control)

Parent

Read-only (Inherited from FrameworkElement)

PointerCaptures

Read-only (Inherited from UIElement)

Projection

Read/write (Inherited from UIElement)

RenderSize

Read-only (Inherited from UIElement)

RenderTransform

Read/write (Inherited from UIElement)

RenderTransformOrigin

Read/write (Inherited from UIElement)

RequestedTheme

Read/write (Inherited from FrameworkElement)

Resources

Read/write (Inherited from FrameworkElement)

Style

Read/write (Inherited from FrameworkElement)

TabIndex

Read/write (Inherited from Control)

TabNavigation

Read/write (Inherited from Control)

Tag

Read/write (Inherited from FrameworkElement)

Template

Read/write (Inherited from Control)

Transitions

Read/write (Inherited from UIElement)

Triggers

Read-only (Inherited from FrameworkElement)

UseLayoutRounding

Read/write (Inherited from UIElement)

VerticalAlignment

Read/write (Inherited from FrameworkElement)

VerticalContentAlignment

Read/write (Inherited from Control)

Visibility

Read/write (Inherited from UIElement)

Width

Read/write (Inherited from FrameworkElement)

 

Remarks

ToggleButton derived classes

ToggleButton is the parent class for several immediately derived controls that toggle and are selectable:

Examples

The following example shows how to create a three-state ToggleButton control.


 <ToggleButton Margin="5" Content="Three State" Width="150" IsThreeState="True"/>
 <ToggleButton Margin="5" Content="Two State" Width="150" IsThreeState="False" />


Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml.Controls.Primitives
Windows::UI::Xaml::Controls::Primitives [C++]

Metadata

Windows.winmd

See also

ButtonBase
AppBarToggleButton
CheckBox
RadioButton

 

 

Show:
© 2014 Microsoft