EditingFieldExtensionsWin.RegisterMaskEditor(String, String, String, MaskType, String) Method
Registers the standard editor with a custom mask to be used for changing control content in Print Preview.
Namespace: DevExpress.XtraPrinting.Preview
Assembly: DevExpress.XtraPrinting.v23.1.dll
NuGet Package: DevExpress.Win.Printing
Declaration
public virtual bool RegisterMaskEditor(
string name,
string displayName,
string category,
MaskType maskType,
string mask
)
Parameters
Name | Type | Description |
---|---|---|
name | String | The name of the editor being registered. |
displayName | String | The display name of the editor being registered. |
category | String | The name of a category to which the editor should be added. |
maskType | MaskType | A MaskType enumeration value which specifies the mask type used. |
mask | String | Specifies the editor’s mask. |
Returns
Type | Description |
---|---|
Boolean | true if an editor has been successfully registered; otherwise, false. |
Remarks
Tip
A complete sample project is available in the DevExpress Code Examples database at https://supportcenter.devexpress.com/ticket/details/t453603/how-to-use-custom-controls-for-editing-report-content-in-print-preview.
To provide a custom editor to be used for editing a control’s content in Print Preview, do the following.
Create a new instance of an appropriate RepositoryItem descendant and specify its settings as required.
using DevExpress.XtraEditors.Repository; //... // Create a new combo box editor with required settings. RepositoryItemComboBox repositoryItemComboBox = new RepositoryItemComboBox() { TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor, ImmediatePopup = true }; // Populate the created editor with items. for (int i = 0; i < 20; i++) repositoryItemComboBox.Items.Add(string.Format("Item {0}", i + 1));
Next, register the editor in a new Custom category by calling the EditingFieldExtensionsWin.RegisterEditor method.
Assign the created editor to a required control using the TextEditOptions.EditorName property.
When you need to use the standard text editor with a custom mask, you can register it using the EditingFieldExtensionsWin.RegisterMaskEditor
method. This method accepts the mask type and mask string as parameters instead of a repository item.
using DevExpress.XtraPrinting.Preview;
// ...
// Register a text editor with a custom mask.
EditingFieldExtensionsWin.Instance.RegisterMaskEditor("PhoneNumberEditor", "Phone Number Editor",
"Custom", DevExpress.XtraEditors.Mask.MaskType.Simple, "(999)000-00-00");