SpreadsheetControl.CommandProvider Property

Gets or sets the SpreadsheetControl's command provider. This is a dependency property.

Namespace: DevExpress.Xpf.Spreadsheet

Assembly: DevExpress.Xpf.Spreadsheet.v20.1.dll

Declaration

public CommandProvider CommandProvider { get; set; }
Public Property CommandProvider As CommandProvider

Property Value

Type Description
DevExpress.Xpf.Spreadsheet.CommandProvider

A DevExpress.Xpf.Spreadsheet.CommandProvider object.

Remarks

A command provider stores commands used by the integrated ribbon. You can use it to assign a command to a ribbon item, as shown in the example below. To get access to the SpreadsheetControl in binding syntax, use the SpreadsheetControl.Spreadsheet property.

The following code snippet demonstrates how to add the Comment button to the Insert ribbon tab, to the new Comments group and bind it to the existing spreadsheet command which inserts a new comment.

TIP

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=T511399.

<dxsps:SpreadsheetControl.RibbonActions>
    <!--Create the Comments group on the Insert tab and add the Comment button to it.-->
    <dxb:InsertAction Index="5" ContainerName="{x:Static dxsps:DefaultBarItemNames.RibbonPage_Insert}">
        <dxr:RibbonPageGroup Caption="Comments">
            <dxb:BarButtonItem Content="Comment"
                               LargeGlyph="{dxsps:SpreadsheetSvgImage Name=InsertComment.svg, UseOfficeImage=True}"
                               Command="{Binding RelativeSource={RelativeSource Self}, Path=(dxsps:SpreadsheetControl.Spreadsheet).CommandProvider.InsertComment}"/>
        </dxr:RibbonPageGroup>
    </dxb:InsertAction>
</dxsps:SpreadsheetControl.RibbonActions>
See Also