[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
 [Collapse]Concepts
  [Expand]Application Solution Components
  [Expand]Business Model Design
  [Expand]Application Model
  [Collapse]UI Construction
    UI Element Overview
    Windows and Frames
   [Expand]Templates
    Action Containers
   [Expand]Views
   [Expand]View Items
    List Editors
    Ways to Access UI Elements and Their Controls
    Add and Override Images
    Text Notifications
    Ways to Show a Confirmation Dialog
    ASP.NET Web Application Appearance
    Ways to Customize a Mobile Application
    Application Personalization
    Using a Custom Control that is not Integrated by Default
    XAF Mobile Wrappers for DevExtreme Widgets
  [Expand]Controllers and Actions
  [Expand]Data Manipulation and Business Logic
  [Expand]Security System
  [Expand]Localization
  [Expand]System Module
  [Expand]Extra Modules
  [Expand]Debugging, Testing and Error Handling
  [Expand]Filtering
  [Expand]Application Life Cycle
 [Expand]Design-Time Features
 [Expand]Deployment
 [Expand]Task-Based Help
  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)

Ways to Access UI Elements and Their Controls

This topic describes how to access UI elements such as View Items, List Editors, Property Editors and their underlying controls.

Create a custom ViewController descendant (or a generic ViewController<ViewType> or ObjectViewController<ViewType, ObjectType>) and implement a solution from one the following sections:

Expanded Tasks with View Items and Property Editors

Get the ViewItem or Property Editor object

Use the CompositeView.FindItem method in the Controller.Activated event handler or overridden ViewController.OnActivated virtual method. The View Item's name should match the corresponding Views | CompositeView | Items | ViewItem Model node's ID property. The default Property Editor's ID matches the property name (see PropertyEditor.PropertyName).

Examples: Access Editor Settings | How to: Access the Dashboard Control


Get View's ViewItem objects collection

Use the CompositeView.Items property in the Controller.Activated event handler or overridden ViewController.OnActivated virtual method.


Get all ViewItem objects of a specific type

Use the CompositeView.GetItems<T> method in the Controller.Activated event handler or overridden ViewController.OnActivated virtual method.

Examples: How to: Access the ASPxDocumentViewer and ASPxWebDocumentViewer Controls | How to: Access the ReportViewer Control


Access a View Item's underlying control

Use the ViewItem.Control property in the ViewItem.ControlCreated event handler. You can also use the overridden ViewItem.OnControlCreated virtual method to access a control of a custom View Item.

Examples: Access Editor Settings | Access Mobile Editor Settings


Access an embedded or nested View's View Item

Use the NestedFrame.ViewItem property in the Controller.Activated event handler or overridden ViewController.OnActivated virtual method.

Examples: How to: Initialize an Object Created Using the New Action | How to: Access Master Detail View and Nested List View Environment


Customize a control of a Property Editor used both in a List and Detail View globally

Create a Property Editor's descendant and customize it. Apply the custom Property Editor to target properties in Model Editor. You can also use this Property Editor for all properties of a specific type.

Examples: How to: Customize a Built-in Property Editor (WinForms | ASP.NET | Mobile)


Access a ViewItem's parent View

Use the ViewItem.View property in the Controller.Activated event handler or overridden ViewController.OnActivated virtual method.


Access the Layout Control and its items

Follow the steps from the View Items Layout Customization topic's Access the Layout Control section.


Expanded Tasks with List Editors

Get the ListEditor object

Use the ListView.Editor property in the Controller.Activated event handler or overridden ViewController.OnActivated virtual method.

Examples: Access Grid Control Properties | Access List Control Properties


Access a List Editor's underlying control

XAF provides various platform-specific List Editors. Each editor has properties, methods, and events for accessing an editor's control. Handle the View.ControlsCreated, ListEditor.ControlsCreated or ViewController.ViewControlsCreated event and use this API in the handler.

Example: ListEditor.Control | How to: Access the List Editor's Control


Access a List Editor's data cell control

There is no common solution for all List Editors. A List Editor can instantiate an internal Property Editor to propagate settings to underlying data cell controls in view and edit modes. Use List Editor's members or customize its underlying control directly as described in the control's documentation. If you want to customize a control globally for List and Detail Views, refer to the Customize a control of a Property Editor used both in a List and Detail View globally section.

Examples: ComplexWebListEditor.FindPropertyEditor | How to: Edit a Reference Property in the Batch Edit Mode | How to add an unbound column to GridListEditor


Expanded Tasks with Complex View Items

Access a control of an Action included to a Detail View layout

To access an ActionContainerViewItem's control, follow the directions from the How to: Include an Action to a Detail View Layout topic.


Access a ListPropertyEditor's control

  1. Use the CompositeView.FindItem method in the Controller.Activated event handler or overridden ViewController.OnActivated virtual method and cast the returned value to ListPropertyEditor.
  2. Handle the ListPropertyEditor's ControlCreated event.
  3. In the event handler, use the ListPropertyEditor's ListView property to get an underlying List View.
  4. Handle the underlying List View's View.ControlsCreated event.
  5. In the event handler, use the ListView.Editor property to get an Editor.
  6. Use this Editor's methods or properties (for example, WinColumnsListEditor.Grid) to access a control.

Access a DetailPropertyEditor's or DashboardViewItem's control

  1. Use the CompositeView.FindItem method in the Controller.Activated event handler or overridden ViewController.OnActivated virtual method and cast the returned value to DetailPropertyEditor or DashboardViewItem.
  2. Handle the DetailPropertyEditor's or DashboardViewItem's ViewItem.ControlCreated event.
  3. In the event handler, use the DetailPropertyEditor's or DashboardViewItem's Frame property to access its Nested Frame.
  4. Use the NestedFrame.ViewItem property to get the Nested View's View Item.
  5. Use the ViewItem.Control property to access a control.

Expanded Additional Information

  • XAF uses DevExpress WinForms, ASP.NET controls and DevExtreme Mobile widgets in applications. You can access and customize these controls and widgets using their members. If you need assistance, submit a new ticket to the Support Center and specify the control's platform in the Platform/Category field.
  • If you customize a control as described in the previous sections and this does not take effect, handle one of the following platform-specific events:

    WinForms

    ASP.NET

    In ASP.NET applications, you can also perform specific customizations on the client-side (see Client-Side Functionality Overview).

  • Most built-in View Items and Editors also provide properties for access a control (for example, GridListEditor.Grid, ASPxPropertyEditor.Editor, ASPxLookupPropertyEditor.DropDown, etc.). Traverse control hierarchy and access inner controls using an index (control.Controls[index]) only if there is no solution for your scenario in this topic and the control's documentation.
  • If you customize an existing control's Application Model options, this customization does not affect the control until its next creation. Customize the control directly or its corresponding Application Model options before the control is created and rendered.

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