DashboardToolbarMenuItem Class
Drop-down menu element, contained in the dashboard title or dashboard item caption.
Namespace: DevExpress.DashboardWin
Assembly: DevExpress.Dashboard.v19.1.Win.dll
Declaration
Remarks
Elements of this type are drop-down menu command buttons located in the dashboard title or dashboard item caption. They are contained in the DashboardToolbarItem.MenuItems collection of a command button. Command buttons are contained in the e.Items collection accessible in the following event handlers:
Component | Event |
---|---|
DashboardViewer | CustomizeDashboardTitle, CustomizeDashboardItemCaption |
DashboardDesigner | CustomizeDashboardTitle, CustomizeDashboardItemCaption |
Example
To add a drop-down menu item to the command button in the DashboardViewer’s dashboard title, handle the CustomizeDashboardTitle event, create a new .DashboardToolbarMenuItem instance, specify its characteristics and add it to the DashboardToolbarItem.MenuItems collection:
using DevExpress.DashboardWin;
// ...
dashboardViewer.CustomizeDashboardTitle += DashboardViewer_CustomizeDashboardTitle;
// ...
private void DashboardViewer_CustomizeDashboardTitle(object sender, CustomizeDashboardTitleEventArgs e)
{
DashboardViewer viewer = (DashboardViewer)sender;
// Add drop-down menu to show/hide dashboard item captions.
DashboardToolbarItem toolbarItemRoot = new DashboardToolbarItem();
toolbarItemRoot.Caption = "Show Dashboard Item Captions";
toolbarItemRoot.SvgImage = svgImageCollection1["title"];
foreach (var item in viewer.Dashboard.Items)
{
DashboardToolbarMenuItem menuItem = new DashboardToolbarMenuItem(item.ShowCaption, item.Name,
new Action<DashboardToolbarItemClickEventArgs>((args) =>
{
item.ShowCaption = !item.ShowCaption;
}));
menuItem.ImageOptions.SvgImage = svgImageCollection1["title"];
toolbarItemRoot.MenuItems.Add(menuItem);
}
e.Items.Insert(0, toolbarItemRoot);
}
Note
The complete sample project WinForms Dashboard - How to customize the dashboard title and dashboard item captions is available in the DevExpress Examples repository.
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the DashboardToolbarMenuItem class.
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.