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.v20.2.dll

Declaration

public virtual bool RegisterMaskEditor(
    string name,
    string displayName,
    string category,
    MaskType maskType,
    string mask
)
Public Overridable Function RegisterMaskEditor(
    name As String,
    displayName As String,
    category As String,
    maskType As MaskType,
    mask As String
) As Boolean

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 http://www.devexpress.com/example=T453603.

To provide a custom editor to be used for editing a control's content in Print Preview, do the following.

  1. 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));
    
  2. Next, register the editor in a new Custom category by calling the EditingFieldExtensionsWin.RegisterEditor method.

    using DevExpress.XtraPrinting.Preview;
    // ...
    
    EditingFieldExtensionsWin.Instance.RegisterEditor
        ("ComboBoxEditor", "ComboBox Editor", "Custom", repositoryItemComboBox);
    
  3. Assign the created editor to a required control using the TextEditOptions.EditorName property.

    using DevExpress.XtraReports.UI;
    // ...
    
    XtraReport1 report = new XtraReport1();
    
    report.xrLabel1.EditOptions.Enabled = true;
    report.xrLabel1.EditOptions.EditorName = "ComboBoxEditor";
    

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");
See Also