Skip to main content
A newer version of this page is available. .

DashboardViewer.SetMasterFilter(String, Object) Method

Selects required elements by their values in the specified master filter item.

Namespace: DevExpress.DashboardWin

Assembly: DevExpress.Dashboard.v19.1.Win.dll

Declaration

public void SetMasterFilter(
    string dashboardItemName,
    object values
)

Parameters

Name Type Description
dashboardItemName String

A String that specifies the component name of the master filter item.

values Object

Values that are used to select elements in the master filter item.

Remarks

Note

The method fires the InvalidOperationException if master filtering is disabled in the specified dashboard item (the MasterFilterMode property is set to None). The exception message text is a localizable string which can be obtained by the MessageInteractivityOperationNotAvailable identifier.

Example

This example demonstrates how to apply master filter to a dashboard in code.

The DashboardViewer.SetMasterFilter method selects rows in the Grid dashboard item that acts as master filter. The DashboardViewer.SetRange method selects a time range in the Range Filter dashboard item that acts as master filter.

Note

The complete sample project How to Set Master Filter in DashboardViewer is available in the DevExpress Examples repository.

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Collections;
using DevExpress.DashboardCommon;

namespace Dashboard_SetMasterFilter {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
            // Loads a dashboard from an XML file.
            dashboardViewer1.LoadDashboard(@"..\..\Data\Dashboard.xml");

            // Creates a list with values to be selected in the Grid dashboard item.
            List<object> rowValues1 = new List<object>();
            rowValues1.AddRange(new[] { "UK", "Anne Dodsworth" } );
            List<object> rowValues2 = new List<object>();
            rowValues2.AddRange(new[] { "USA", "Andrew Fuller" } );
            List<IList> selectedRows = new List<IList>( new[] {rowValues1, rowValues2} );

            // Creates a range with specified minimum and maximum values.
            DateTime minimumValue = new DateTime(1995, 3, 1);
            DateTime maximumValue = new DateTime(1995, 10, 1);
            RangeFilterSelection selectedRange = new RangeFilterSelection(minimumValue, maximumValue);

            // Selects specified values in the Grid dashboard item.
            dashboardViewer1.SetMasterFilter("gridDashboardItem1", selectedRows);
            // Selects a specified range in the Range Filter dashboard item.
            dashboardViewer1.SetRange("rangeFilterDashboardItem1", selectedRange);
        }
    }
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the SetMasterFilter(String, Object) 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.

See Also