[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Expand]Controls and Libraries
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Collapse]API Reference
  [Expand]DevExpress.Charts.Designer
  [Expand]DevExpress.Data
  [Expand]DevExpress.Mvvm.UI
  [Expand]DevExpress.Mvvm.UI.Interactivity
  [Expand]DevExpress.Mvvm.UI.ModuleInjection
  [Expand]DevExpress.Xpf.Accordion
  [Expand]DevExpress.Xpf.Bars
  [Expand]DevExpress.Xpf.Carousel
  [Expand]DevExpress.Xpf.Charts
  [Expand]DevExpress.Xpf.Charts.Localization
  [Expand]DevExpress.Xpf.Charts.RangeControlClient
  [Expand]DevExpress.Xpf.ChunkList
  [Expand]DevExpress.Xpf.Controls
  [Expand]DevExpress.Xpf.Core
  [Expand]DevExpress.Xpf.Core.ConditionalFormatting
  [Expand]DevExpress.Xpf.Core.DataSources
  [Expand]DevExpress.Xpf.Core.FilteringUI
  [Expand]DevExpress.Xpf.Core.Native
  [Expand]DevExpress.Xpf.Core.ServerMode
  [Expand]DevExpress.Xpf.Data
  [Expand]DevExpress.Xpf.DataAccess
  [Expand]DevExpress.Xpf.DataAccess.DataSourceWizard
  [Expand]DevExpress.Xpf.Diagram
  [Expand]DevExpress.Xpf.Dialogs
  [Expand]DevExpress.Xpf.Docking
  [Expand]DevExpress.Xpf.Docking.Base
  [Expand]DevExpress.Xpf.DocumentViewer
  [Expand]DevExpress.Xpf.DXBinding
  [Expand]DevExpress.Xpf.Editors
  [Expand]DevExpress.Xpf.Editors.DataPager
  [Expand]DevExpress.Xpf.Editors.DateNavigator
  [Expand]DevExpress.Xpf.Editors.ExpressionEditor
  [Expand]DevExpress.Xpf.Editors.ExpressionEditor.Native
  [Expand]DevExpress.Xpf.Editors.Filtering
  [Expand]DevExpress.Xpf.Editors.Flyout
  [Expand]DevExpress.Xpf.Editors.Flyout.Native
  [Expand]DevExpress.Xpf.Editors.Helpers
  [Expand]DevExpress.Xpf.Editors.Native
  [Expand]DevExpress.Xpf.Editors.Popups
  [Expand]DevExpress.Xpf.Editors.RangeControl
  [Expand]DevExpress.Xpf.Editors.Settings
  [Expand]DevExpress.Xpf.Editors.Validation
  [Expand]DevExpress.Xpf.ExpressionEditor
  [Expand]DevExpress.Xpf.Gantt
  [Expand]DevExpress.Xpf.Gauges
  [Expand]DevExpress.Xpf.Gauges.Localization
  [Expand]DevExpress.Xpf.Grid
  [Expand]DevExpress.Xpf.Grid.ConditionalFormatting
  [Expand]DevExpress.Xpf.Grid.LookUp
  [Expand]DevExpress.Xpf.Grid.TreeList
  [Expand]DevExpress.Xpf.Layout.Core
  [Expand]DevExpress.Xpf.LayoutControl
  [Expand]DevExpress.Xpf.Map
  [Expand]DevExpress.Xpf.NavBar
  [Expand]DevExpress.Xpf.Navigation
  [Expand]DevExpress.Xpf.PdfViewer
  [Expand]DevExpress.Xpf.PivotGrid
  [Expand]DevExpress.Xpf.PivotGrid.Printing
  [Expand]DevExpress.Xpf.Printing
  [Expand]DevExpress.Xpf.Printing.Parameters
  [Expand]DevExpress.Xpf.Printing.Parameters.Models
  [Expand]DevExpress.Xpf.Printing.PreviewControl
  [Expand]DevExpress.Xpf.Printing.PreviewControl.Bars
  [Expand]DevExpress.Xpf.Prism
  [Expand]DevExpress.Xpf.PropertyGrid
  [Expand]DevExpress.Xpf.Reports.UserDesigner
  [Expand]DevExpress.Xpf.Reports.UserDesigner.Extensions
  [Expand]DevExpress.Xpf.Reports.UserDesigner.Localization
  [Expand]DevExpress.Xpf.Reports.UserDesigner.ReportWizard
  [Expand]DevExpress.Xpf.Reports.UserDesigner.ReportWizard.Pages
  [Expand]DevExpress.Xpf.Ribbon
  [Expand]DevExpress.Xpf.RichEdit
  [Expand]DevExpress.Xpf.RichEdit.Menu
  [Expand]DevExpress.Xpf.Scheduler
  [Expand]DevExpress.Xpf.Scheduler.Drawing
  [Expand]DevExpress.Xpf.Scheduler.Menu
  [Expand]DevExpress.Xpf.Scheduler.Reporting
  [Expand]DevExpress.Xpf.Scheduler.UI
  [Expand]DevExpress.Xpf.Scheduling
  [Expand]DevExpress.Xpf.Scheduling.Common
  [Expand]DevExpress.Xpf.Scheduling.Editors
  [Expand]DevExpress.Xpf.Scheduling.iCalendar
  [Expand]DevExpress.Xpf.Scheduling.Reporting
  [Expand]DevExpress.Xpf.Scheduling.Visual
  [Expand]DevExpress.Xpf.Scheduling.VisualData
  [Expand]DevExpress.Xpf.SpellChecker
  [Expand]DevExpress.Xpf.Spreadsheet
  [Expand]DevExpress.Xpf.Spreadsheet.Menu
  [Expand]DevExpress.Xpf.TreeMap
  [Expand]DevExpress.Xpf.Utils.Themes
  [Collapse]DevExpress.Xpf.WindowsUI
   [Expand]AnimationSelector Class
    AnimationType Enumeration
   [Expand]AppBar Class
   [Collapse]AppBarButton Class
     AppBarButton Members
     AppBarButton Constructor
    [Expand]AppBarButton Properties
    [Expand]AppBarButton Methods
   [Expand]AppBarSeparator Class
   [Expand]AppBarToggleButton Class
   [Expand]CommandButton Class
   [Expand]FlipView Class
   [Expand]FlipViewItem Class
   [Expand]Flyout Class
   [Expand]HamburgerMenu Class
   [Expand]HamburgerMenuAdaptiveLayoutController Class
    HamburgerMenuAvailableViewStates Enumeration
   [Expand]HamburgerMenuBottomBarCheckBox Class
    HamburgerMenuBottomBarItemPlacement Enumeration
   [Expand]HamburgerMenuBottomBarNavigationButton Class
   [Expand]HamburgerMenuBottomBarRadioButton Class
   [Expand]HamburgerMenuHyperlinkButton Class
    HamburgerMenuItemPlacement Enumeration
   [Expand]HamburgerMenuNavigationButton Class
   [Expand]HamburgerMenuSelectedItemChangedEventArgs Class
   [Expand]HamburgerMenuToggleStateButton Class
    HamburgerMenuViewState Enumeration
   [Expand]HamburgerSubMenu Class
    HamburgerSubMenuMoreButtonVisibility Enumeration
   [Expand]HamburgerSubMenuNavigationButton Class
    ItemSizeMode Enumeration
   [Expand]MenuFlyout Class
   [Expand]MenuFlyoutItem Class
   [Expand]MenuFlyoutSeparator Class
   [Expand]NavigationButton Class
    NavigationCacheMode Enumeration
   [Expand]NavigationFrame Class
   [Expand]NavigationPage Class
   [Expand]PageAdornerControl Class
    PageHeadersLayoutType Enumeration
   [Expand]PageView Class
   [Expand]PageViewItem Class
    PrefetchedSourcesOptions Enumeration
   [Expand]SlideView Class
   [Expand]SlideViewItem Class
   [Expand]SlideViewItemClickEventArgs Class
   [Expand]WinUIDialogWindow Class
   [Expand]WinUIMessageBox Class
  [Expand]DevExpress.Xpf.WindowsUI.Internal
  [Expand]DevExpress.Xpf.WindowsUI.Navigation
  [Expand]DevExpress.XtraRichEdit
  [Expand]DevExpress.XtraRichEdit.Printing
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

AppBarButton Class

Represents the button in the AppBar.

Namespace:DevExpress.Xpf.WindowsUI
Assembly:DevExpress.Xpf.Controls.v19.1.dll

Expanded Syntax

Expanded Remarks

Buttons in the AppBar are represented by the AppBarButton and AppBarToggleButton classes. The app bar buttons are round buttons with labels which invoke an associated action on a click. To implement an action, you can assign a Command to its Command property or handle the Click event.

A label can be set from the Label property of the Object type. In most cases, you use a String value to specify the button's label, but it is possible to use any Object. If an assigned object is not derived from the UIElement class, the ToString method is used to display the label. So, you can override this method to customize the return value if necessary. Use the AppBarButton's FontFamily and FontSize properties to define the label's text attributes. It is also possible to apply data templates to render the button's label. For this purpose, the AppBarButton provides the LabelTemplate and LabelTemplateSelector properties.

You can display an icon in the app bar button. For this purpose, use its CommandButton.Glyph property. The CommandButton.GlyphWidth and CommandButton.GlyphHeight properties specify the dimensions of the frame into which the icon is fitted. The CommandButton.GlyphStretch property specifies how the icon is stretched to fill the frame. To paint the icon according to the currently applied theme, set the CommandButton.AllowGlyphTheming property to True.

Using the CommandButton.Glyph property is the recommended approach to specifying the button icon, but it is also possible to use the Content property. Any object can be assigned to this property. The following is a list of typical objects that can be used as button content.

  • String — Displays any text or a single character. Use the ContentFontFamily and ContentFontSize properties to define the content's text attributes. The Segoe UI Symbol font provides numerous symbols you may need.
  • Path — Allows you to define a Shape as the button's glyph.
  • Image — Allows you to display a custom image. You can also use an image from the DX Image Gallery.

See the AppBar Control topic, to learn more.

Expanded Example

The following example shows how to create an app bar containing custom regular and toggle buttons, the predefined Exit button, and the button that displays a flyout when clicked.

In this example, the AppBar control is populated with the AppBarButton and AppBarToggleButton objects, which are divided into groups using the AppBarSeparator objects. To display the predefined Exit button, the AppBar.IsExitButtonEnabled property is set to True.

The button captions are specified using the Label property. The HorizontalAlignment property specifies the button alignment relative to the app bar.

The CommandButton.Glyph property is used to provide the buttons with icons from the DX Image Gallery. The glyph theming feature is enabled for all buttons and the glyph height is set using the Style declared in the app bar's Resources. You can also use the button's Content property to specify the button icons. See the Pin button — the icon for this button is specified using the Unicode symbol that corresponds to the glyph in the Segoe UI Symbol font. For more information about how to use Segoe UI Symbol icons, see Guidelines on MSDN.

The Rotate button displays the flyout when clicked. The button's Flyout property allows you associate the Flyout or MenuFlyout control with the button.

The result of the markup in this example is shown below.

Expanded Inheritance Hierarchy

System.Object
    System.Windows.Threading.DispatcherObject
       System.Windows.DependencyObject
          System.Windows.Media.Visual
             System.Windows.UIElement
                System.Windows.FrameworkElement
                   System.Windows.Controls.Control
                      System.Windows.Controls.ContentControl
                         System.Windows.Controls.Primitives.ButtonBase
                            System.Windows.Controls.Button
                               CommandButton
                                  DevExpress.Xpf.WindowsUI.AppBarButtonBase
                                     AppBarButton
                                        AppBarToggleButton

Expanded See Also

Is this topic helpful?​​​​​​​