PropertyEditor.DisplayFormat Property
Specifies the display format string for the Property Editor’s value.
Namespace: DevExpress.ExpressApp.Editors
Assembly: DevExpress.ExpressApp.v24.2.dll
NuGet Package: DevExpress.ExpressApp
Declaration
Property Value
Type | Description |
---|---|
String | The format string for the Property Editor’s value. |
Remarks
The DisplayFormat property uses a syntax similar to that in String.Format() method calls. If a Property Editor displays date-time values, you can apply the following format string: Due Date: {0:MMM/d/yyyy hh:mm tt}
:
The DisplayFormat property value can contain literal characters (displayed as is) and a value placeholder. In the format string example above, the Due Date:
text is displayed as is. The value placeholder is {0:MMM/d/yyyy hh:mm tt}
.
The placeholder syntax is {0[:formatString]}
. Since a Property Editor contains a single value, the index is always 0. The formatString
portion is optional. It sets Format Specifiers that determine how the editor converts its value into display text.
You can set the DisplayFormat property in the Application Model. Locate the View Item node that corresponds to the Property Editor. In that node, set the DisplayFormat property value. The following topic gives an example of how you can do this in the Model Editor: Apply the Display Format to an Integer Property Value.
You can also set the DisplayFormat property in Controller code:
public partial class ViewController1 : ViewController<DetailView> {
// ...
protected override void OnActivated() {
base.OnActivated();
var editor = View.FindItem("ZipPostal") as ASPxStringPropertyEditor;
editor.DisplayFormat = "Zip Code: {0}";
}
// ...
}
Change Display Format Dynamically
The controller sets the DisplayFormat property in the OnActivated event, when the PropertyEditor’s control is not created. If you change the DisplayFormat property after a control was created, the new value does not not appear in the UI. Use the following solution to change formatting settings in this case:
For more information on how to access editors in code, see the following topics: View Items and Property Editors and Access the Settings of a Property Editor in a Detail View.
If you create a custom Property Editor that should support the DisplayFormat property, implement your logic to apply the DisplayFormat property value to the custom editor.