wpf-devexpress-dot-xpf-dot-ribbon-dot-ribbonpagegroup-ba76a062.md
Gets or sets the command to invoke when the group’s Caption Button is clicked. This is a dependency property.
Namespace : DevExpress.Xpf.Ribbon
Assembly : DevExpress.Xpf.Ribbon.v25.2.dll
NuGet Package : DevExpress.Wpf.Ribbon
public ICommand CaptionButtonCommand { get; set; }
Public Property CaptionButtonCommand As ICommand
| Type | Description |
|---|---|
| ICommand |
The command to invoke when the group’s Caption Button is clicked.
|
The Caption button is a clickable element at the right bottom corner of a RibbonPageGroup. Its visibility can be toggled via the RibbonPageGroup.ShowCaptionButton property. You can implement the Caption Button functionality by either handling the RibbonPageGroup.CaptionButtonClick event or using the CaptionButtonCommand property. The RibbonPageGroup.CaptionButtonClick event is fired before the CaptionButtonCommand is executed.
For more information about use of the Caption Button command, see the example below.
The following figure illustrates a RibbonControl containing a ‘Font’ RibbonPageGroup that has a Caption Button (hovered by the mouse cursor in the figure). The example demonstrates how to attach a command to a Caption Button via the RibbonPageGroup.CaptionButtonCommand property.
When the Caption Button is clicked, the ‘Font Preferences’ window is displayed.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using DevExpress.Xpf.Ribbon;
namespace RibbonCustomization {
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window {
public static RoutedCommand FontOptionsMenu = new RoutedCommand();
public MainWindow() {
DevExpress.Xpf.Core.ApplicationThemeHelper.ApplicationThemeName = "Seven";
InitializeComponent();
}
private void FontOptionsMenuExecuted(object sender, ExecutedRoutedEventArgs e) {
new FontMenuWindow().Show();
}
private void FontOptionsMenuExecute(object sender, CanExecuteRoutedEventArgs e) {
e.CanExecute = true;
}
}
}
Main Ribbon Window Xaml File
<Window x:Class="RibbonCustomization.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
xmlns:dxdb="http://schemas.devexpress.com/winfx/2008/xaml/demobase"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxr="http://schemas.devexpress.com/winfx/2008/xaml/ribbon"
xmlns:custom="clr-namespace:RibbonCustomization"
Title="Ribbon Customization guide" Height="350" Width="525">
<Window.CommandBindings>
<CommandBinding Command="{x:Static custom:MainWindow.FontOptionsMenu}"
Executed="FontOptionsMenuExecuted"
CanExecute="FontOptionsMenuExecute"/>
</Window.CommandBindings>
<Grid Name="mainGrid">
<dxb:BarManager Name="myBarManager">
...
<dxr:RibbonControl Name="myRibbonControl" Grid.Row="0">
...
<dxr:RibbonDefaultPageCategory Caption="defaultCategory" Name="ribbonDefaultPageCategory">
...
<dxr:RibbonPageGroup Caption="Font" Name="pgFont" ShowCaptionButton="True" CaptionButtonCommand="{x:Static custom:MainWindow.FontOptionsMenu}">
<dxb:BarSubItemLink BarItemName="siFontFamily" BarItemDisplayMode="Default" />
<dxb:BarSubItemLink BarItemName="siFontSize" />
<dxb:BarButtonItemLink BarItemName="biBold" />
<dxb:BarButtonItemLink BarItemName="biItalic" />
<dxb:BarButtonItemLink BarItemName="biUnderlined" />
</dxr:RibbonPageGroup>
...
</dxr:RibbonDefaultPageCategory>
...
</dxr:RibbonControl>
...
</dxb:BarManager>
</Grid>
</Window>
The following code snippets (auto-collected from DevExpress Examples) contain references to the CaptionButtonCommand property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
</dxr:RibbonPageGroup>
<dxr:RibbonPageGroup x:Name="grpHomeFont" CaptionButtonCommand="{Binding FormatCellsFont, Mode=OneTime, Source={StaticResource commands}}" Caption="{Binding ConverterParameter=Caption_GroupFont, Converter={StaticResource stringIdConverter}, Mode=OneTime, Source={StaticResource stringIdConverter}}">
<dxr:RibbonPageGroup.ItemLinks>
</dxr:RibbonPageGroup>
<dxr:RibbonPageGroup x:Name="grpHomeFont" CaptionButtonCommand="{Binding FormatCellsFont, Mode=OneTime, Source={StaticResource commands}}" Caption="{Binding ConverterParameter=Caption_GroupFont, Converter={StaticResource stringIdConverter}, Mode=OneTime, Source={StaticResource stringIdConverter}}">
<dxr:RibbonPageGroup.ItemLinks>
</dxr:RibbonPageGroup>
<dxr:RibbonPageGroup x:Name="grpHomeFont" Caption="{Binding ConverterParameter=Caption_GroupFont, Converter={StaticResource stringIdConverter}, Mode=OneTime, Source={StaticResource stringIdConverter}}" CaptionButtonCommand="{Binding FormatCellsFont, Mode=OneTime, Source={StaticResource commands}}">
<dxr:RibbonPageGroup.ItemLinks>
See Also