Skip to main content

BackstageButtonItem Class

A button item within a BackstageViewControl.

Namespace: DevExpress.Xpf.Ribbon

Assembly: DevExpress.Xpf.Ribbon.v14.2.dll

#Declaration

public class BackstageButtonItem :
    BackstageItem

#Remarks

The BackstageButtonItem class allows you to create regular buttons within a BackstageViewControl. You can set the Content property to place text or any object that will be displayed inside a button. Use the BackstageItem.ContentTemplate and the BackstageItemBase.ContentStyle to customize your button's appearance. If you want to set an icon for your button, use the BackstageButtonItem.Glyph member.

The purpose of any button item is to perform certain actions when a button is clicked by a user. To bind an action to your button, use the BackstageButtonItem.Command property or the BackstageItemBase.Click event.

If you want to place a button within a BackstageViewControl, add a BackstageButtonItem class instance to the control's Items collection. To add a button in XAML, , define a BackstageButtonItem object between the BackstageViewControl opening and closing tags. See the example below to learn more.

#Examples

Imagine you want to create a BackstageViewControl with a button, a tab item and a separator item between them, as seen in the following figure:

DXRibbon backstageViewControl items adding

To add these items via a XAML markup, define new BackstageButtonItem, BackstageTabItem and BackstageSeparatorItem class objects between the opening and closing tags of a BackstageViewControl. When an end-user selects the tab item, a label and two radio buttons should be displayed at the right of BackstageViewControl. To add multiple items as a tab item's content, define a container, place these items inside of it and initialize the ControlPane property with this container. In this example, a Grid container is used. The button item's BackstageItemBase.Click event is used to respond to an end-user clicking this button.

<dxr:RibbonControl.ApplicationMenu>
    <dxr:BackstageViewControl  Name ="myViewControl" DisableDefaultBackgroundGlyph="False">
        <dxr:BackstageButtonItem Content="Open last file" Margin ="0,0,0,10" Name="cmdOpen" Click="cmdOpen_Click"/>
        <dxr:BackstageSeparatorItem/>
        <dxr:BackstageTabItem Name="optionsTab" Margin="0,10,0,0" Content="Options">
            <dxr:BackstageTabItem.ControlPane>
                <Grid Margin="10,5,0,0">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"></RowDefinition>
                        <RowDefinition Height="Auto"></RowDefinition>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                <TextBlock Text="Ribbon style:" Margin="5,10,5,5" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" FontSize="16" FontWeight="Bold"/>
                <RadioButton Content="Office 2007" Grid.Row="1" Grid.Column="0" Margin="5,0,5,0"/>
                <RadioButton Content="Office 2010" Grid.Row="1" Grid.Column="1" Margin="5,0,5,0"/>
                </Grid>
            </dxr:BackstageTabItem.ControlPane>
        </dxr:BackstageTabItem>
    </dxr:BackstageViewControl>
</dxr:RibbonControl.ApplicationMenu>
See Also