Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Collapse]eXpressApp Framework
 [Expand]Fundamentals
 [Expand]Getting Started
 [Expand]Concepts
 [Expand]Design-Time Features
 [Expand]Functional Testing
 [Expand]Deployment
 [Collapse]Task-Based Help
  [Expand]Business Model Design
  [Expand]Application Model
  [Collapse]Actions
    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]Navigation
  [Expand]Views
  [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
 [Expand]Frequently Asked Questions
 [Expand]API Reference
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Customize Action Controls

This example demonstrates how to customize the control that visualizes an Action in a UI. A custom Action will be created, allowing users to enter a date and filter the List View accordingly. The implemented Action will accept keyboard input, as well as provide a drop-down calendar. The control representing the Action will be customized to accept keyboard input using a custom mask. The image below shows the resulting Action in a UI.

Note

You can see a demonstration of the following controllers (the CustomizeMenuActionsController for ASP.NET and CustomizeParametrizedActionController for WinForms) in the Actions section of the Feature Center application that is shipped with XAF. By default, the Feature Center demo is installed in %PUBLIC%\Documents\DevExpress Demos 17.1\Components\eXpressApp Framework\FeatureCenter. The ASP.NET version of this demo is available online at http://demos.devexpress.com/XAF/FeatureCenter/.

First, define the sample MyDomainObject business class. The class contains two properties. The first is the "CreatedOn" property of the DateTime type, and the second is the "Title" property of the string type.

Next, create a new View Controller and define a ParametrizedAction. Configure the Controller and Action so that they activate for the MyDomainObject class only. Set the Action's ParametrizedAction.ValueType to DateTime. In the Action's ParametrizedAction.Execute event handler, check whether a date was entered. If a date was entered, filter the MyDomainObject List View to contain only the objects whose "CreatedOn" property's value equals the entered date. If a user has executed the Action with an empty edit field, remove the applied filter, so that the List View displays all the objects, without regard to their creation date.

To set up a custom edit mask, subscribe to the ActionBase.CustomizeControl event. This event allows you to customize the created items control, and provides access to the corresponding Action Control.

  • WinForms

  • ASP.NET

Expanded See Also

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