dashboard-devexpress-dot-dashboardwin-dot-datefiltercontrol-40902383.md
Allows you to specify the date picker text.
Namespace : DevExpress.DashboardWin
Assembly : DevExpress.Dashboard.v25.2.Win.dll
NuGet Package : DevExpress.Win.Dashboard
public event EventHandler<CustomDisplayTextEventArgs> CustomDisplayText
Public Event CustomDisplayText As EventHandler(Of CustomDisplayTextEventArgs)
The CustomDisplayText event's data class is CustomDisplayTextEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| DisplayText | Gets or sets an editor’s display text. |
| Value | Gets an editor’s current value. |
The CustomDisplayText event fires before a date picker caption is displayed and allows you to change it.
This code snippet specifies the date picker button’s caption.
using DevExpress.DashboardWin;
using DevExpress.XtraEditors.Controls;
using System;
// ...
dashboardViewer1.DashboardItemControlCreated += DashboardViewer1_DashboardItemControlCreated;
// ...
private void DashboardViewer1_DashboardItemControlCreated(object sender, DashboardItemControlEventArgs e)
{
if (e.DateFilterControl != null)
{
dateFilter.CustomDisplayText += DateFilter_CustomDisplayText;
}
}
private void DateFilter_CustomDisplayText(object sender, CustomDisplayTextEventArgs e)
{
e.DisplayText = (e.Value is DateTime) ? string.Format("{0:d}", e.Value) : "Click for the Date Picker";
}
Imports DevExpress.DashboardWin
Imports DevExpress.XtraEditors.Controls
Imports System
' ...
AddHandler dashboardViewer1.DashboardItemControlCreated, AddressOf DashboardViewer1_DashboardItemControlCreated
' ...
Private Sub DashboardViewer1_DashboardItemControlCreated(ByVal sender As Object, ByVal e As DevExpress.DashboardWin.DashboardItemControlEventArgs)
If e.DateFilterControl IsNot Nothing Then
AddHandler dateFilter.CustomDisplayText, AddressOf DateFilter_CustomDisplayText
End If
End Sub
Private Sub DateFilter_CustomDisplayText(ByVal sender As Object, ByVal e As CustomDisplayTextEventArgs)
e.DisplayText = If(TypeOf e.Value Is Date, String.Format("{0:d}", e.Value), "Click for the Date Picker")
End Sub
See Also