Skip to main content
Bar

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

PopupMenu.Items Property

Provides access to bar items and bar item links displayed in this PopupMenu.

Namespace: DevExpress.Xpf.Bars

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

NuGet Package: DevExpress.Wpf.Core

#Declaration

public CommonBarItemCollection Items { get; }

#Property Value

Type Description
DevExpress.Xpf.Bars.CommonBarItemCollection

A DevExpress.Xpf.Bars.CommonBarItemCollection collection that contains bar items and bar item links displayed in this PopupMenu.

#Remarks

You can add BarItem and BarItemLink descendants to the Items collection.

The PopupMenu class has the System.Windows.Markup.ContentPropertyAttribute attribute that marks the Items property as the XAML content property. So in XAML, bar items and bar item links defined between the PopupMenu start and end tags will be added to the current Items collection.

#Example

This example shows how to associate a popup menu with a TextBox control via the BarManager.DXContextMenu attached property.

The following image shows the result:

E1675

View Example

<Window
    x:Class="DXContextMenu_Ex.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
    Height="300" Width="300"
    Title="Window1">
    <Grid>
        <DockPanel>
            <TextBox
                x:Name="textEdit1"
                Width="200"
                Height="30"
                Text="right-click this textbox">
                <dxb:BarManager.DXContextMenu>
                    <dxb:PopupMenu>
                        <dxb:PopupMenu.Items>
                            <dxb:BarButtonItem
                                Content="Copy"
                                Glyph="pack://application:,,,/Images/copy16x16.png"
                                ItemClick="itemCopy_ItemClick" />
                            <dxb:BarButtonItem
                                Content="Paste"
                                Glyph="pack://application:,,,/Images/paste16x16.png"
                                ItemClick="itemPaste_ItemClick" />
                            <dxb:BarButtonItem
                                Content="Undo"
                                Glyph="pack://application:,,,/Images/undo16x16.png"
                                ItemClick="itemUndo_ItemClick" />
                            <dxb:BarButtonItem
                                Content="Redo"
                                Glyph="pack://application:,,,/Images/redo16x16.png"
                                ItemClick="itemRedo_ItemClick" />
                        </dxb:PopupMenu.Items>
                    </dxb:PopupMenu>
                </dxb:BarManager.DXContextMenu>
            </TextBox>
        </DockPanel>
    </Grid>
</Window>

The following code snippets (auto-collected from DevExpress Examples) contain references to the Items 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.

#Implements

See Also