Skip to content

DevExpress-Examples/xaf-how-to-dynamically-change-mask-settings-based-on-the-current-object

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XAF - How to dynamically change mask settings based on the current object

This example demonstrates how to change mask settings of a certain editor dynamically (for example, based on properties of the current object).

example

Implementation Details

There are two ways to implement this functionality:

  1. Implement a ViewController that handles events of the current view and changes settings of required editors, as shown in the following topic: Access the Settings of a Property Editor in a Detail View.
  2. Implement a custom Property Editor (for example, a descendant of the corresponding built-in property editor) and change settings of the associated underlying control. For more information, refer to the following help section: Property Editors.

This example demonstrates the first approach. To implement it, the following classes are added:

  • DemoObject - a persistent class with TestString and Mask properties. Mask settings of the TestString property are changed based on the value of the Mask property.
  • ChangeMaskControllerBase - a platform-independent controller that handles events required to update the mask settings at the appropriate time.
  • WinChangeMaskController - a WinForms-specific controller that customizes settings of a WinForms control.
  • BlazorChangeMaskController - a Blazor-specific controller that customizes settings of a Blazor control.

Note that these approaches can be used only for detail views. To implement the same functionality in a ListView, create a ViewController for it and customize its List Editor according to specifics of the List Editor's control (see How to: Access the Grid Component in a List View). For example, in WinForms you can use the GridView.CustomColumnDisplayText event to pass the required text directly to a grid cell. You can also use the GridView.CustomRowCellEdit event to supply editors with different settings for different rows.

Files to Review

Documentation

More Examples

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)