Back to Devexpress

DashboardViewer.UpdateDashboardTitle() Method

dashboard-devexpress-dot-dashboardwin-dot-dashboardviewer-57405044.md

latest6.8 KB
Original Source

DashboardViewer.UpdateDashboardTitle() Method

Fires the CustomizeDashboardTitle event that allows you to customize the dashboard title content.

Namespace : DevExpress.DashboardWin

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

NuGet Package : DevExpress.Win.Dashboard

Declaration

csharp
public void UpdateDashboardTitle()
vb
Public Sub UpdateDashboardTitle

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 UpdateDashboardTitle() method.

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-customize-title-and-item-captions/CS/CustomizeDashboardItemCaptionExample/ViewerForm1.cs#L22

csharp
dashboardViewer.UpdateDashboardTitle();
UpdateDashboardItemCaptions();

winforms-dashboard-viewer-tab-navigation-buttons-tab-animation/CS/DashboardNextPrevTab/ViewerForm.cs#L23

csharp
dashboardViewer.SelectedTabPageChanged += DashboardViewerSelectedTabPageChanged;
dashboardViewer.UpdateDashboardTitle();

winforms-dashboard-customize-title-and-item-captions/VB/CustomizeDashboardItemCaptionExample/ViewerForm1.vb#L25

vb
dashboardViewer.UpdateDashboardTitle()
UpdateDashboardItemCaptions()

winforms-dashboard-viewer-tab-navigation-buttons-tab-animation/VB/DashboardNextPrevTab/ViewerForm.vb#L27

vb
AddHandler dashboardViewer.SelectedTabPageChanged, AddressOf DashboardViewerSelectedTabPageChanged
dashboardViewer.UpdateDashboardTitle()
SetUpTimer()

Implements

UpdateDashboardTitle()

See Also

CustomizeDashboardItemCaption

DashboardViewer Class

DashboardViewer Members

DevExpress.DashboardWin Namespace