Skip to main content
A newer version of this page is available. .

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.v19.1.dll

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

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the RegisterMaskEditor(String, String, String, MaskType, String) method.

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.

See Also