Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

BaseLayoutItem.ContextMenuCustomizationsTemplate Property

Gets or sets a template used to customize menu items in all affected dock layout items. This is a dependency property.

Namespace: DevExpress.Xpf.Docking

Assembly: DevExpress.Xpf.Docking.v24.2.dll

NuGet Package: DevExpress.Wpf.Docking

#Declaration

public DataTemplate ContextMenuCustomizationsTemplate { get; set; }

#Property Value

Type Description
DataTemplate

A DataTemplate used to customize menu items.

#Remarks

Use the ContextMenuCustomizationsTemplate property to specify a template used to customize the menu items in all the affected layout items.

<Window x:Class="ContextMenuCustomizationTemplate.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:dxdo="http://schemas.devexpress.com/winfx/2008/xaml/docking"
        xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars">
    <Grid>
        <Grid.Resources>
            <!-- Specifies common context menu customizations for all affected dock panels -->
            <Style TargetType="dxdo:LayoutPanel">
                <Setter Property="ContextMenuCustomizationsTemplate">
                    <Setter.Value>
                        <DataTemplate>
                            <ItemsControl>
                                <!-- Removes the 'Floating' item -->
                                <dxb:RemoveBarItemAction ItemName="{x:Static  dxdo:DefaultMenuItemNames.Floating}" />
                                <!-- Adds a separator -->
                                <dxb:BarItemSeparator />
                                <!-- Adds a custom bar item -->
                                <dxb:BarButtonItem Content="Test Bar Item" />
                            </ItemsControl>
                        </DataTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Grid.Resources>
        <dxdo:DockLayoutManager>
            <dxdo:LayoutGroup>
                <dxdo:LayoutPanel Caption="Panel1" />
                <dxdo:LayoutPanel Caption="Panel2" />
                <dxdo:LayoutPanel Caption="Panel3" />
            </dxdo:LayoutGroup>
        </dxdo:DockLayoutManager>
    </Grid>
</Window>

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ContextMenuCustomizationsTemplate property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also