MaskProperties.UseMaskAsDisplayFormat Property
Gets or sets whether to use mask settings to format the editor’s display text when the editor is not focused.
Namespace: DevExpress.XtraEditors.Mask
Assembly: DevExpress.XtraEditors.v24.1.dll
NuGet Package: DevExpress.Win.Navigation
Declaration
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public virtual bool UseMaskAsDisplayFormat { get; set; }
Property Value
Type | Default | Description |
---|---|---|
Boolean | false | true to use mask settings to format the editor’s display text when the editor is not focused; false to use formatting settings specified by the DisplayFormat property. |
Remarks
Enable the UseMaskAsDisplayFormat
property to apply mask settings to the editor’s display text (when the editor is not focused). As a result the editor’s text in edit and display mode will be identical.
The following example creates a DateTime editor to display/edit values in the ‘OrderDate’ grid column. The editor uses mask settings to format its value in edit and display modes:
using System;
using System.Windows.Forms;
using DevExpress.XtraBars.Ribbon;
using DevExpress.XtraEditors.Repository;
namespace DXApplication {
public partial class Form1 : RibbonForm {
RepositoryItemDateEdit dateEditor;
public Form1() {
InitializeComponent();
// Forcibly initialize the DevExpress GridControl.
gridControl1.ForceInitialize();
// Create and initialize a repository item (cell editor) to edit DateTime values.
dateEditor = new RepositoryItemDateEdit() {
Name = "orderDateEditor",
EditMask = "D",
UseMaskAsDisplayFormat = true
};
// Add the repository item to the grid's RepositoryItems collection.
gridControl1.RepositoryItems.Add(dateEditor);
// Assign the repository item to the 'OrderDate' column.
gridView1.Columns["OrderDate"].ColumnEdit = dateEditor;
}
}
}
The following image shows the result:
If the UseMaskAsDisplayFormat
property is set to false, the editor’s display text is formatted based on settings specified by the DisplayFormat property.
Note
Setting the UseMaskAsDisplayFormat
property has no effect if the editor’s MaskProperties.MaskType property is set to MaskType.None
.
Read the following topic for additional information: Input Mask.
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the UseMaskAsDisplayFormat property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.