ToggleButton
ToggleButton
is a “sticky” button that holds its state when it is clicked. Clicking it the first time sets its IsChecked
property to true
, and clicking it again sets IsChecked
to false
. The default appearance of ToggleButton
is the same as that of Button
and RepeatButton
, and when IsChecked
is true
it retains its pressed appearance. It can be used for enabling and disabling features, such as bold/italic/underline buttons on a text editor’s toolbar, and is great when space is limited. Otherwise, it’s often more appropriate to use a ToggleSwitch
control (covered in Chapter 14, “Other Controls”) instead.
ToggleButton
also has an IsThreeState
property that, if set to true
, gives IsChecked
three possible values: true
, false
, or null ...
Get Universal Windows® Apps with XAML and C# Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.