Skip to content

Latest commit

 

History

History
62 lines (39 loc) · 4 KB

appbartogglebutton.md

File metadata and controls

62 lines (39 loc) · 4 KB
-api-id -api-type
T:Windows.UI.Xaml.Controls.AppBarToggleButton
winrt class

Windows.UI.Xaml.Controls.AppBarToggleButton

-description

Represents a button control that can switch states and be displayed in an AppBar.

-xaml-syntax

<AppBarToggleButton .../>

-remarks

An AppBarToggleButton is similar to an AppBarButton with an additional toggle state. When used inside a CommandBar. the visual appearance changes based on whether the control appears in the primary commands or the overflow menu. Here is an example of a toggled button as both a primary command and secondary command.

App bar button icon examples.

Control style and template

You can modify the default Style and ControlTemplate to give the control a unique appearance. For information about modifying a control's style and template, see Styling controls. The default style, template, and resources that define the look of the control are included in the generic.xaml file. For design purposes, generic.xaml is available locally with the SDK or NuGet package installation.

  • WinUI Styles (recommended): For updated styles from WinUI, see \Users\<username>\.nuget\packages\microsoft.ui.xaml\<version>\lib\uap10.0\Microsoft.UI.Xaml\Themes\generic.xaml.
  • Non-WinUI styles: For built-in styles, see %ProgramFiles(x86)%\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP\<SDK version>\Generic\generic.xaml.

Locations might be different if you customized the installation. Styles and resources from different versions of the SDK might have different values.

XAML also includes resources that you can use to modify the colors of a control in different visual states without modifying the control template. Modifying these resources is preferred to setting properties such as Background and Foreground. For more info, see the Light-weight styling section of the XAML styles article. Light-weight styling resources are available starting in Windows 10, version 1607 (SDK 14393).

Version history

Windows version SDK version Value added
1607 14393 DynamicOverflowOrder
1607 14393 IsInOverflow
1607 14393 LabelPosition
1803 17134 KeyboardAcceleratorTextOverride
1803 17134 TemplateSettings

-examples

Tip

For more info, design guidance, and code examples, see Command bar.

[!div class="nextstepaction"] Open the WinUI 2 Gallery app and see the AppBarToggleButton in action

The WinUI 2 Gallery app includes interactive examples of most WinUI 2 controls, features, and functionality. Get the app from the Microsoft Store or get the source code on GitHub.

-see-also

Control, AppBar, AppBarButton, AppBarSeparator, CommandBar, ToggleButton, Controls list, Controls by function, Commanding sample (Windows 10)