This example demonstrates how to change mask settings of a certain editor dynamically (for example, based on properties of the current object).
There are two ways to implement this functionality:
- 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. - 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 withTestString
andMask
properties. Mask settings of theTestString
property are changed based on the value of theMask
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.
- Multi-currency DisplayFormats in a ListView
- Formatting depending on another field value
- How to apply a (DisplayFormat) Mask to a value shown in a ListView?
(you will be redirected to DevExpress.com to submit your response)