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
OnActivatedmethod, retrieveDashboardViewItemsvia theFindItemmethod, and subscribe to theControlCreatedevent of aDashboardViewItemwhoseListViewis used to filter data (hereinafter referred to asSourceView). - In the
ControlCreatedevent handler retrieve theSourceViewvia the DashboardViewItem.InnerView property and subscribe to its SelectionChanged event. - In the
SelectionChangedevent 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
CriteriaOperatorto the TargetView.CollectionSource.Criteria dictionary to filter theTargetView. In this example, we created anInOperatorthat usesSourceViewobjects 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+
(you will be redirected to DevExpress.com to submit your response)
