Skip to main content

RibbonPageGroup.CaptionButtonCommandTarget Property

Gets or sets the element on which to raise the RibbonPageGroup.CaptionButtonCommand. This is a dependency property.

Namespace: DevExpress.Xpf.Ribbon

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

#Declaration

public IInputElement CaptionButtonCommandTarget { get; set; }

#Property Value

Type Description
IInputElement

The element on which to raise the RibbonPageGroup.CaptionButtonCommand.

#Remarks

To learn how commands are applied to caption buttons, see the example below.

#Examples

The following figure illustrates the ribbon control object (RibbonControl) containing the 'Font' group (RibbonPageGroup). The group has a caption button (the one the cursor points at) with a command hooked up to it. This command shows the window with advanced font style parameters:

Caption Button Example Image

The command hooked in this example is a RoutedCommand type. It's specified via the RibbonPageGroup.CaptionButtonCommand property and can have it's target to affect on (RibbonPageGroup.CaptionButtonCommandTarget) and custom parameters (RibbonPageGroup.CaptionButtonCommandParameter). Defining the command in the Window.CommandBindings section makes it reusable for other elements (e.g. sub-menus).

The C# code and XAML markup below shows how commanding logic can be implemented:

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.ThemeManager.ApplicationThemeName = "Seven";
            InitializeComponent();

        }
        private void FontOptionsMenuExecuted(object sender, ExecutedRoutedEventArgs e) {
            new FontMenuWindow().Show();
        }

        private void FontOptionsMenuExecute(object sender, CanExecuteRoutedEventArgs e) {
            e.CanExecute = true;
        }
    }
}
See Also