SpreadsheetControl.MenuCustomizations Property

Allows you to customize a menu by adding new menu items or removing existing ones. This is a dependency property.

Namespace: DevExpress.Xpf.Spreadsheet

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

Declaration

public ObservableCollection<SpreadsheetMenuCustomization> MenuCustomizations { get; set; }
Public Property MenuCustomizations As ObservableCollection(Of SpreadsheetMenuCustomization)

Property Value

Type Description
ObservableCollection<SpreadsheetMenuCustomization>

A SpreadsheetMenuCustomization object.

Examples

This example demonstrates how to use the SpreadsheetMenuCustomization.Customizations property to add custom items to the popup menu of the SpreadsheetControl or remove the existing ones. Use the SpreadsheetMenuCustomization.MenuType property to determine the visual element for which the popup menu is invoked.

<dxb:BarManager x:Name="barManager1" ToolbarGlyphSize="Small">
    <dxb:BarManager.Items>
        <dxb:BarButtonItem
            x:Name="customNewFile"
            Command="{Binding FileNew, Mode=OneTime, Source={StaticResource commands}}"
            Content="Custom Create New File" />
        <dxb:BarButtonItem
            x:Name="customMergeCells"
            Command="{Binding EditingMergeAndCenterCells, Mode=OneTime, Source={StaticResource commands}}"
            Content="Custom Merge Cells" />
    </dxb:BarManager.Items>
    <Grid>
        <dxsps:SpreadsheetControl
            x:Name="spreadsheetControl1"
            BarManager="{Binding ElementName=barManager1, Mode=OneTime}"
            PopupMenuShowing="SpreadsheetControlPopupMenuShowing">
            <dxsps:SpreadsheetControl.MenuCustomizations>
                <dxsps:SpreadsheetMenuCustomization MenuType="Cell">
                    <dxb:BarButtonItemLink dxb:BarItemLinkActionBase.ItemLinkIndex="0">
                        <dxb:BarButtonItemLink.BarItemName>
                            customMergeCells
                        </dxb:BarButtonItemLink.BarItemName>
                    </dxb:BarButtonItemLink>
                </dxsps:SpreadsheetMenuCustomization>
                <dxsps:SpreadsheetMenuCustomization>
                    <dxb:BarButtonItemLink dxb:BarItemLinkActionBase.ItemLinkIndex="1">
                        <dxb:BarButtonItemLink.BarItemName>
                            customNewFile
                        </dxb:BarButtonItemLink.BarItemName>
                    </dxb:BarButtonItemLink>
                </dxsps:SpreadsheetMenuCustomization>
                <dxsps:SpreadsheetMenuCustomization>
                    <dxb:BarItemLinkSeparator dxb:BarItemLinkActionBase.ItemLinkIndex="2" />
                </dxsps:SpreadsheetMenuCustomization>
                <dxsps:SpreadsheetMenuCustomization MenuType="ColumnHeading">
                    <dxsps:RemoveSpreadsheetCommandAction 
                        Id="{x:Static dxspscore:SpreadsheetCommandId.HideColumnsContextMenuItem}" />
                    <dxsps:RemoveSpreadsheetCommandAction 
                        Id="{x:Static dxspscore:SpreadsheetCommandId.UnhideColumnsContextMenuItem}" />
                </dxsps:SpreadsheetMenuCustomization>
            </dxsps:SpreadsheetControl.MenuCustomizations>
        </dxsps:SpreadsheetControl>
    </Grid>
</dxb:BarManager>
See Also