[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Collapse]eXpressApp Framework
 [Expand]Fundamentals
 [Expand]Getting Started
 [Expand]Concepts
 [Expand]Design-Time Features
 [Expand]Deployment
 [Collapse]Task-Based Help
  [Expand]Business Model Design
  [Expand]Application Model
  [Expand]Actions
  [Expand]Navigation
  [Collapse]Views
    How to: Access Objects Selected in the Current View
    How to: Access Master Detail View and Nested List View Environment
    How to: Create and Show a Detail View of the Selected Object in a Popup Window
    How to: Customize Tabs Generation in a Mobile Detail View
    How to: Detect a Lookup List View in Code
    How to: Display a Detail View Directly in Edit Mode in ASP.NET and Mobile Applications
    How to: Display a List View as a Chart
    How to: Display a List View as a Pivot Grid Table and Chart
    How to: Display Several Views Side-by-Side
    How to: Hide Collection Properties in an Edit Mode Detail View for an ASP.NET Application
    How to: Implement a Singleton Business Object and Show its Detail View
    How to: Implement a View Item
    How to: Show a Custom Data-Bound Control in an XAF View (ASP.NET)
    How to: Show a Custom Data-Bound Control in an XAF View (WinForms)
  [Expand]List Editors
  [Expand]Property Editors
  [Expand]Templates
  [Expand]Filtering
  [Expand]Reporting
  [Expand]Dashboards
  [Expand]Scheduler and Notifications
  [Expand]Maps
  [Expand]Security
  [Expand]Workflow
  [Expand]Localization
  [Expand]Testing
  [Expand]Miscellaneous UI Customizations
  Frequently Asked Questions (FAQ)
 [Expand]API Reference
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

How to: Access Master Detail View and Nested List View Environment

This topic explains how to use Controllers to access a nested List View's or a master Detail View's environment (Frames, Controllers, Actions, Objects, etc.).

This article covers two approaches:

This topic uses the 'Contact Detail View with a Tasks nested List View' scenario. You can find the corresponding Contact and DemoTask business classes in the MainDemo application (%PUBLIC%\Documents\DevExpress Demos 18.2\Components\eXpressApp Framework\MainDemo).

Note

XAF creates nested List Views for Collection Properties. These properties are often used in Relationships Between Persistent Objects.

Expanded How to: Access a Master Detail View's Environment from a Nested List View Controller

Choose the best approach for your scenario:

If you need to access the master View from the DashboardViewItem (see DashboardViewItem) or the DetailPropertyEditor, use the Access a Master Detail View's Frame and its Controllers approach. See the E4916 article for an example.

Access a Master Detail View's Frame and its Controllers

This approach requires two Controllers: The first is a nested List View Controller. In the code below, the NestedListViewFrameController receives the parent Frame in the AssignMasterFrame method. You can use this Frame to customize its Controllers and Actions. See Customize Controllers and Actions for more information.

Note

Nested List View Controllers cannot access the parent Detail View Frame, Controllers, and Actions unless the Detail View's Controller passes the Detail View Frame to the nested List View Controller.

The second is a master Detail View Controller. The MasterDetailViewController below acquires the Detail View Frame and passes it to the NestedListViewFrameController. Use the ListPropertyEditor.FrameChanged event subscription to ensure the nested List View exists.

Tip

Download the E1012 example to see this approach in a sample application.

Access a Master Detail View's Current Object (the View Item Approach)

The AccessParentDetailViewController below is a nested List View Controller. The Controller uses the View.CurrentObjectChanged event to update the master Detail View Caption (see View.Caption) each time the CurrentObject (see ListView.CurrentObject) changes.

Tip

Download the E3977 example to see this approach in a sample application.

Access a Master Detail View's Current Object (the Property Collection Source Approach)

The AccessMasterObjectController below is a nested List View Controller. The nested List View's ListView.CollectionSource type is PropertyCollectionSource because the List View represents a collection property. The Controller handles the PropertyCollectionSource.MasterObjectChanged event and processes the current PropertyCollectionSource.MasterObject when the master object changes.

Tip

Download the E950 example to see this approach in a sample application.

Expanded How to: Access a Nested List View's Environment from a Detail View Controller

The AccessNestedListViewController below is a Detail View Controller. The Controller handles the the View.CurrentObjectChanged and ViewItem.ControlCreated events to get the current nested List View's Frame and object. You can process them in the PerformLogicWithCurrentListViewObject and PerformLogicInNestedListViewController methods as the Customize Controllers and Actions topic describes.

Note

You can also use this approach to customize the DashboardViewItem (see DashboardViewItem) and the DetailPropertyEditor because these View Items contain a Frame with an inner View. See the E4916 article for an example.

Tip

Download the E3977 example to see this approach in a sample application.

Expanded See Also

Is this topic helpful?​​​​​​​