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:
- Inherit from the Business Class Library Class (XPO/EF core)
- Place an Action in a Different Location
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 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.
Note
In .NET 5, the libraries used for globalization functionality has been changed. Refer to the following topic for details: Globalization APIs use ICU libraries on Windows.
If a current thread’s culture is set to a culture that includes only the language and not the country (for example, “de” or “en”), the currency symbol renders as an international currency symbol (¤
), for example: 100,00 ¤
.
Refer to the following topics for details: