This example illustrates how to filter a ListView displayed in a DashboardView based on another ListView's selection.
When a DashboardView contains several list views, it is often required to make them dependent, e.g. display items of one ListView based on items or selection of another ListView.
- Add a new ViewController to the YourSolutionName.Module project. For more information, refer to the following file: DashboardFilterController.cs.
- In the
OnActivated
method, retrieveDashboardViewItems
via theFindItem
method, and subscribe to theControlCreated
event of aDashboardViewItem
whoseListView
is used to filter data (hereinafter referred to asSourceView
). - In the
ControlCreated
event handler retrieve theSourceView
via the DashboardViewItem.InnerView property and subscribe to its SelectionChanged event. - In the
SelectionChanged
event handler, retrieve the View to be filtered (hereinafter referred to asTargetView
) in the same way as the previous step. - To get an object that is used for filtering, use the ListView.CurrentObject property.
- You can now add
CriteriaOperator
to the TargetView.CollectionSource.Criteria dictionary to filter theTargetView
. In this example, we created anInOperator
that usesSourceView
objects to filter the AssignedTo column.
You can find the ASP.NET WebForms version of this example in the following branch: DevExpress-Examples/xaf-how-to-implement-dependent-views-in-a-dashboardview-filter-based-on-selection at 17.2.3+