Skip to main content

RichEditControl.CommandProvider Property

Gets or sets a RichEditControl’s command provider. This is a dependency property.

Namespace: DevExpress.Xpf.RichEdit

Assembly: DevExpress.Xpf.RichEdit.v24.1.dll

NuGet Package: DevExpress.Wpf.RichEdit


public CommandProvider CommandProvider { get; set; }

Property Value

Type Description

A DevExpress.Xpf.RichEdit.CommandProvider object.


A command provider stores commands used by the integrated ribbon. You can use it to assign a command to a command bar item, as described in the table below.

This example demonstrates how to customize the RichEdit’s integrated Ribbon UI. The tasks and required property settings are listed in the table.


Property Setting

Use integrated Ribbon UI

Set the RichEditControl.CommandBarStyle property to the CommandBarStyle.Ribbon value.

Load a document

Specify the RichEditControl.DocumentSource property. The DXBinding extension allows you to call a method that returns a valid document source directly in XAML.

Determine the ribbon item name

Element names are the fields of the DevExpress.Xpf.RichEdit.DefaultBarItemNames class. However, you can easily deduce the required element name by following simple naming rules as demonstrated in the table below.


Item Type

Page Name

Group Name

Item Name

DefaultBarItemNames Field





Document Properties


Remove a command bar item.

Add a new RemoveAction to the RichEditControl.RibbonActions collection.

Modify a command bar item.

Add a new UpdateAction to the RichEditControl.RibbonActions collection. Set the UpdateAction.PropertyName attribute to the name of the property you wish to change, the UpdateAction.Value attribute is the new property value.

Insert a command bar item.

Add a new InsertAction to the RichEditControl.RibbonActions collection.

Create a command to assign to the command bar item.

To obtain a command for binding, specify the CommandProvider object’s field which has the same name as the command. The CommandProvider object is accessible using the RichEditControl.CommandProvider property. To get access to the RichEditControl in binding syntax, use the RichEditControl.RichEdit property.


<dxre:RichEditControl  Name="richEditControl1" CommandBarStyle="Ribbon" DocumentSource="{DXBinding '$local:SourceHelper.GetDocumentSource()'}">
        <dxb:RemoveAction ElementName="{x:Static dxre:DefaultBarItemNames.RibbonPage_Review}"/>
        <dxb:RemoveAction ElementName="{x:Static dxre:DefaultBarItemNames.RibbonGroup_PageLayout_PageBackground}"/>
        <dxb:RemoveAction ElementName="{x:Static dxre:DefaultBarItemNames.RibbonItem_File_Info_DocumentProperties}"/>
        <dxb:RemoveAction ElementName="{x:Static dxre:DefaultBarItemNames.RibbonPage_Review}"/>
        <dxb:RemoveAction ElementName="{x:Static dxre:DefaultBarItemNames.RibbonPage_MailMerge}"/>
        <dxb:UpdateAction ElementName="{x:Static dxre:DefaultBarItemNames.RibbonPage_View}" PropertyName="IsSelected"  Value="True"/>
        <dxb:InsertAction Index="2" ContainerName="{x:Static dxre:DefaultBarItemNames.RibbonPage_View}">
            <dxr:RibbonPageGroup Caption="Demo">
                <dxb:BarButtonItem Content="About"
                                   LargeGlyph="{dx:DXImageOffice2013 Image=Info_32x32.png}"
        <dxb:InsertAction Index="7" ContainerName="{x:Static dxre:DefaultBarItemNames.RibbonPage_Insert}">
            <dxr:RibbonPageGroup Caption="Comments">
                <dxb:BarButtonItem Content="Comment"
                                   LargeGlyph="{dx:DXImage Image=NewComment_32x32.png}"
                                   Command="{Binding RelativeSource={RelativeSource Self}, Path=(dxre:RichEditControl.RichEdit).CommandProvider.NewComment}"/>
See Also