Back to Devexpress

DashboardDesigner.CustomizeDashboardTitle Event

dashboard-devexpress-dot-dashboardwin-dot-dashboarddesigner-f124dc37.md

latest10.1 KB
Original Source

DashboardDesigner.CustomizeDashboardTitle Event

Allows you to customize the dashboard title at runtime.

Namespace : DevExpress.DashboardWin

Assembly : DevExpress.Dashboard.v25.2.Win.dll

NuGet Package : DevExpress.Win.Dashboard

Declaration

csharp
public event CustomizeDashboardTitleEventHandler CustomizeDashboardTitle
vb
Public Event CustomizeDashboardTitle As CustomizeDashboardTitleEventHandler

Event Data

The CustomizeDashboardTitle event's data class is CustomizeDashboardTitleEventArgs. The following properties provide information specific to this event:

PropertyDescription
FilterTextGets or sets the text displayed in the dashboard title or in the dashboard item caption. The text identifies a single master filter value applied to the dashboard. Inherited from CustomizeDashboardCaptionBaseEventArgs.
ItemsProvides access to command buttons located in the dashboard title or in the dashboard item’s caption. Inherited from CustomizeDashboardCaptionBaseEventArgs.
TextGets or sets the text displayed in the dashboard title or the dashboard item caption. Inherited from CustomizeDashboardCaptionBaseEventArgs.

Remarks

The DashboardDesigner.CustomizeDashboardTitle event is raised when the dashboard is loaded (the DashboardDesigner.Dashboard property is changed) or when end-user activities affect the dashboard title. Such activities include applying a master filter, performing drill-down or changing the parameter value.

You can change displayed text, remove existing buttons, add custom buttons or command bar items, including drop-down menus.

Example

The following code snippets demonstrate how to load data in the Dashboard designer on demand when all required filters are set. For this, the Show Data button is created in the DashboardDesigner.CustomizeDashboardTitle event handler.

csharp
using DevExpress.DashboardWin;
using System;
using System.Linq;

namespace CustomShowDataExample
{
    public partial class DesignerForm1 : DevExpress.XtraBars.Ribbon.RibbonForm
    {
        public DesignerForm1()
        {
            InitializeComponent();
            dashboardDesigner.CustomizeDashboardTitle += DashboardDesigner_CustomizeDashboardTitle;
            dashboardDesigner.LoadDashboard(@"..\..\Dashboards\dashboard1.xml");
        }

        #region #CustomizeDashboardTitle
        private void DashboardDesigner_CustomizeDashboardTitle(object sender, CustomizeDashboardTitleEventArgs e)
        {
            DevExpress.Data.IParameter showDataParameter = dashboardDesigner.Parameters.FirstOrDefault(p => p.Name == "ShowData");
            if (showDataParameter != null)
            {
                bool showData = (bool)showDataParameter.Value;
                DashboardToolbarItem showDataItem = new DashboardToolbarItem(showData, "Select states in the State list box and click this button to display data",
                    new Action<DashboardToolbarItemClickEventArgs>((args) => {
                        showDataParameter.Value = !showData;
                    }));
                showDataItem.Caption = "Show Data";
                showDataItem.SvgImage = svgImageCollection1[0];
                e.Items.Insert(0, showDataItem);
            }
        }
        #endregion #CustomizeDashboardTitle
    }
}
vb
Imports DevExpress.DashboardWin
Imports System
Imports System.Linq

Namespace CustomShowDataExample
    Partial Public Class DesignerForm1
        Inherits DevExpress.XtraBars.Ribbon.RibbonForm

        Public Sub New()
            InitializeComponent()
            AddHandler dashboardDesigner.CustomizeDashboardTitle, AddressOf DashboardDesigner_CustomizeDashboardTitle
            dashboardDesigner.LoadDashboard("..\..\Dashboards\dashboard1.xml")
        End Sub

        #Region "#CustomizeDashboardTitle"
        Private Sub DashboardDesigner_CustomizeDashboardTitle(ByVal sender As Object, ByVal e As CustomizeDashboardTitleEventArgs)
            Dim showDataParameter As DevExpress.Data.IParameter = dashboardDesigner.Parameters.FirstOrDefault(Function(p) p.Name = "ShowData")
            If showDataParameter IsNot Nothing Then
                Dim showData As Boolean = DirectCast(showDataParameter.Value, Boolean)
                Dim showDataItem As DashboardToolbarItem = New DashboardToolbarItem(showData, "Select states in the State list box and click this button to display data", New Action(Of DashboardToolbarItemClickEventArgs)(Sub(args)
                    showDataParameter.Value = Not showData
                End Sub))
                showDataItem.Caption = "Show Data"
                showDataItem.SvgImage = svgImageCollection1(0)
                e.Items.Insert(0, showDataItem)
            End If
        End Sub
        #End Region ' #CustomizeDashboardTitle
    End Class
End Namespace

The following code snippets (auto-collected from DevExpress Examples) contain references to the CustomizeDashboardTitle event.

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.

winforms-dashboard-designer-merge-dashboards-to-tabs/CS/DesignerForm.cs#L17

csharp
dashboardDesigner.CreateRibbon();
dashboardDesigner.CustomizeDashboardTitle += DashboardDesignerCustomizeDashboardTitle;
dashboardDesigner.UpdateDashboardTitle();

winforms-dashboard-custom-database-schema-for-sql-data-sources/CS/Dashboard_CustomSchemaProvider/Form1.cs#L8

csharp
dashboardDesigner1.CreateRibbon();
dashboardDesigner1.CustomizeDashboardTitle += DashboardDesigner1_CustomizeDashboardTitle;

winforms-dashboard-custom-properties/CS/WinForms-Dashboard-Custom-Properties/Modules/DashboardDescriptionModule.cs#L29

csharp
barItem.ItemClick += DescriptionBarItem_Click;
designer.CustomizeDashboardTitle += Designer_CustomizeDashboardTitle;
designer.DashboardCustomPropertyChanged += Designer_DashboardCustomPropertyChanged;

winforms-dashboard-designer-merge-dashboards-to-tabs/VB/DesignerForm.vb#L18

vb
dashboardDesigner.CreateRibbon()
AddHandler dashboardDesigner.CustomizeDashboardTitle, AddressOf DashboardDesignerCustomizeDashboardTitle
dashboardDesigner.UpdateDashboardTitle()

winforms-dashboard-custom-database-schema-for-sql-data-sources/VB/Dashboard_CustomSchemaProvider/Form1.vb#L10

vb
dashboardDesigner1.CreateRibbon()
AddHandler dashboardDesigner1.CustomizeDashboardTitle, AddressOf DashboardDesigner1_CustomizeDashboardTitle

winforms-dashboard-custom-properties/VB/WinForms-Dashboard-Custom-Properties/Modules/DashboardDescriptionModule.vb#L29

vb
AddHandler barItem.ItemClick, AddressOf DescriptionBarItem_Click
AddHandler designer.CustomizeDashboardTitle, AddressOf Designer_CustomizeDashboardTitle
AddHandler designer.DashboardCustomPropertyChanged, AddressOf Designer_DashboardCustomPropertyChanged

Implements

CustomizeDashboardTitle

See Also

DashboardDesigner Class

DashboardDesigner Members

DevExpress.DashboardWin Namespace