Format a Property Value
- 2 minutes to read
This lesson explains how to format a business class property and specify its mask settings.
In this lesson, you will customize the display format for the Task.StartDate, Task.DueDate, and Task.PercentCompleted properties in the Model Editor.
Note
Before you proceed, take a moment to review the following lessons:
Step-by-Step Instructions
- In the MySolution.Module project, open the Model.DesignedDiffs.xafml file in the Model Editor.
- Navigate to the BOModel | DevExpress.Persistent.BaseImpl | Task | OwnMembers node.
For the StartDate and DueDate child nodes, change the values of the following properties:
- Set the DisplayFormat property to
D
. - Set the set the EditMask property value to
d
.
- Set the DisplayFormat property to
For the PercentCompleted child node, set the DisplayFormat property to
{0:N0}%
.Run the application. Invoke a detail form for the DemoTask class. The StartDate and DueDate properties are formatted depending on the focus state. When the property editor is focused, the EditMask is applied, and the property value is formatted according to the short date pattern (the
d
edit mask). When the property editor is not focused, the DisplayFormat is applied, and the property value is formatted according to the long date pattern (theD
format specifier).
The PercentCompleted property value is appended with the ‘%’ sign.