dashboard-devexpress-dot-dashboardwin-dot-dashboardviewer-6a2ec5e7.md
Occurs before data is loaded from the data store and allows you to customize dashboard parameters that are used for data processing.
Namespace : DevExpress.DashboardWin
Assembly : DevExpress.Dashboard.v25.2.Win.dll
NuGet Package : DevExpress.Win.Dashboard
public event CustomParametersEventHandler CustomParameters
Public Event CustomParameters As CustomParametersEventHandler
The CustomParameters event's data class is CustomParametersEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| Parameters | Gets or sets dashboard parameters. |
The CustomParameters event provides access to a collection of dashboard parameters (CustomParametersEventArgs.Parameters) and allows you to change actual parameter values, parameter settings or even add new parameters. Note that parameter values specified in the CustomParameters event handler are used only for data processing and are not displayed in the Dashboard Parameters dialog.
For information on how to use the DashboardViewer.DashboardLoaded event to specify default parameter values, see the following example:
View Example: How to Specify Default Parameter Values in the WinForms Viewer
The following example shows how to filter a custom SQL query by changing a parameter value in the DashboardViewer.CustomParameters event handler.
In this example, the custIDQueryParameter query parameter is included in a WHERE clause of a custom SQL query. The custIDQueryParameter parameter is also bound to the hidden custIDDashboardParameter dashboard parameter. The value of this parameter is changed at runtime by handling the DashboardViewer.CustomParameters event which is raised before the DashboardViewer sends a query to a database.
using DevExpress.DashboardCommon;
using System.Linq;
namespace Dashboard_CustomParameters_Win {
public partial class Form1 : DevExpress.XtraEditors.XtraForm {
public Form1() {
InitializeComponent();
dashboardViewer1.LoadDashboard(@"..\..\Data\Dashboard.xml");
}
private void dashboardViewer1_CustomParameters(object sender, CustomParametersEventArgs e) {
var custIDParameter = e.Parameters.FirstOrDefault(p => p.Name == "custIDDashboardParameter");
if (custIDParameter != null) {
custIDParameter.Value = "AROUT";
}
}
}
}
Imports DevExpress.DashboardCommon
Imports System.Linq
Namespace Dashboard_CustomParameters_Win
Partial Public Class Form1
Inherits DevExpress.XtraEditors.XtraForm
Public Sub New()
InitializeComponent()
dashboardViewer1.LoadDashboard("..\..\Data\Dashboard.xml")
End Sub
Private Sub dashboardViewer1_CustomParameters(ByVal sender As Object, ByVal e As CustomParametersEventArgs) Handles dashboardViewer1.CustomParameters
Dim custIDParameter = e.Parameters.FirstOrDefault(Function(p) p.Name = "custIDDashboardParameter")
If custIDParameter IsNot Nothing Then
custIDParameter.Value = "AROUT"
End If
End Sub
End Class
End Namespace
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CustomParameters 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.
InitializeComponent();
dashboardViewer.CustomParameters += DashboardViewer_CustomParameters;
dashboardViewer.DashboardSource = typeof(SampleDashboard);
InitializeComponent()
AddHandler dashboardViewer.CustomParameters, AddressOf DashboardViewer_CustomParameters
dashboardViewer.DashboardSource = GetType(SampleDashboard)
See Also