Log In
[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]Document Server
[Expand]Report Server
[Collapse]eXpressApp Framework
 [Expand]Getting Started
 [Expand]Design-Time Features
 [Expand]Functional Testing
 [Collapse]Task-Based Help
  [Expand]Business Model Design
  [Expand]Application Model
    How to: Add a Search Action to Lookup Property Editors and Link Pop-up Windows
    How to: Add the Analyze Action to List Views
    How to: Create an Action Using the Action Attribute
    How to: Customize Action Controls
    How to: Customize the Export Action Behavior
    How to: Customize the New Action's Items List
    How to: Deactivate (Hide) an Action in Code
    How to: Disable an Action When the Current View Has Unsaved Changes
    How to: Hide the Edit Action Column from a ListView in an ASP.NET Application
    How to: Initialize an Object Created Using the New Action
    How to: Limit the Amount of Objects Created using the New Action
    How to: Make the FullTextSearch Action Search Within Required Properties
    How to: Reorder an Action Container's Actions Collection
    How to: Replace a List View's Default Action
  [Expand]List Editors
  [Expand]Property Editors
  [Expand]Scheduler and Notifications
  [Expand]Miscellaneous UI Customizations
  Frequently Asked Questions
 [Expand]API Reference
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Replace a List View's Default Action

List Views can be accompanied by Actions that represent features specific to these List Views. In addition to these Actions, every List View has an invisible default Simple Action. In Windows Forms applications, this Action is executed when pressing the ENTER key or double-clicking a selected object. In ASP.NET Web applications, this Action is executed when an object is clicked. This Action is specified by the ListViewProcessCurrentObjectController's ListViewProcessCurrentObjectController.ProcessCurrentObjectAction property. You can replace this Action with a custom Simple Action. This topic demonstrates how to do this.


The approach described in this topic is not supported by the Mobile platform. If it is necessary to implement this scenario in your Mobile application, contact us using the Support Center.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E3275.

Expanded Set a Custom Action as Default

Assume you have the following AddressBookRecord persistent class.

Let us consider the WriteMailController View Controller that provides the WriteMail Action for AddressBookRecord objects. This Action invokes the program that is associated with the MailTo protocol on an end-user's computer.

By default, the Action specified by the ProcessCurrentObjectAction property of the ListViewProcessCurrentObjectController invokes a Detail View with the clicked object (the ListViewShowObject Action is specified by default). However, the ListViewProcessCurrentObjectController exposes the ListViewProcessCurrentObjectController.CustomProcessSelectedItem event, which you can handle to replace the default Action. The code below demonstrates how to handle this event in WriteMailController to execute a WriteMail Action instead of ListViewShowObject. Subscribe to the CustomProcessSelectedItem event in the overridden OnActivated method. In the event handler, execute the WriteMail Action by invoking the SimpleAction.DoExecute method.

The following image illustrates that the WriteMail action is executed when clicking a record in the AddressBookRecord objects' List View.

You may notice that now there is no option to invoke a Detail View to edit a record. You can add to following Controller to fix this.


Such a controller is required for Windows Forms applications only, as the WebModificationsController.EditAction Action is available in ASP.NET applications.

To leave an option to replace the WriteMail Action in another Controller, you can expose this action via a public property.

Proceed to the next section of this topic to see how this property can be used.

Expanded Replace a Custom Default Action

Consider the following PhoneCallController View Controller than provides the PhoneCall Action. This action initiates dialing PhoneNumber of the current AddressBookRecord object in Skype.

The List View's default Action provided by the custom WriteMailController Controller can be replaced with another Action, if it is exposed via a public property. To replace the WriteMail action with PhoneCall, add the following code to the PhoneCallController class' OnActivated method.

The following image illustrates that the PhoneCall action is executed when clicking a record in the AddressBookRecord objects' List View.

Subscribing to the ListViewProcessCurrentObjectController's CustomProcessSelectedItem event, as demonstrated at the beginning of this topic is not a recommended, since there is the possibility that the PhoneCallController Controller will be activated after WriteMailController, and so the WriteMail Action will remain default.


An example provided in this topic is Windows Forms specific just because Actions that start external programs use the Process.Start method. However, the main concept illustrated here in platform-independent - you can access the ListViewProcessCurrentObjectController Controller from ASP.NET-specific Controllers in the same manner.

How would you rate this topic?​​​​​​​