Skip to main content

SpreadsheetControl.CommandProvider Property

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

Namespace: DevExpress.Xpf.Spreadsheet

Assembly: DevExpress.Xpf.Spreadsheet.v23.2.dll

NuGet Package: DevExpress.Wpf.Spreadsheet

Declaration

public CommandProvider CommandProvider { get; set; }

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.

<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}"
                               Command="{Binding RelativeSource={RelativeSource Self}, Path=(dxsps:SpreadsheetControl.Spreadsheet).CommandProvider.InsertComment}"/>
        </dxr:RibbonPageGroup>
    </dxb:InsertAction>
</dxsps:SpreadsheetControl.RibbonActions>
See Also