WPF

Upgrade Guide User Guide Demos Support Forums Download
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class MaskAttribute - WPF API Reference | Syncfusion MaskEditor in PropertyGrid. ">

    Show / Hide Table of Contents

    Class MaskAttribute

    Specifies the input mask for a property, so that it can be edited using MaskEditor in PropertyGrid.

    Inheritance
    System.Object
    System.Attribute
    MaskAttribute
    Implements
    System.Runtime.InteropServices._Attribute
    Inherited Members
    System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Type)
    System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Type, System.Boolean)
    System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo)
    System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Boolean)
    System.Attribute.IsDefined(System.Reflection.MemberInfo, System.Type)
    System.Attribute.IsDefined(System.Reflection.MemberInfo, System.Type, System.Boolean)
    System.Attribute.GetCustomAttribute(System.Reflection.MemberInfo, System.Type)
    System.Attribute.GetCustomAttribute(System.Reflection.MemberInfo, System.Type, System.Boolean)
    System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo)
    System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Type)
    System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Type, System.Boolean)
    System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Boolean)
    System.Attribute.IsDefined(System.Reflection.ParameterInfo, System.Type)
    System.Attribute.IsDefined(System.Reflection.ParameterInfo, System.Type, System.Boolean)
    System.Attribute.GetCustomAttribute(System.Reflection.ParameterInfo, System.Type)
    System.Attribute.GetCustomAttribute(System.Reflection.ParameterInfo, System.Type, System.Boolean)
    System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Type)
    System.Attribute.GetCustomAttributes(System.Reflection.Module)
    System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Boolean)
    System.Attribute.GetCustomAttributes(System.Reflection.Module, System.Type, System.Boolean)
    System.Attribute.IsDefined(System.Reflection.Module, System.Type)
    System.Attribute.IsDefined(System.Reflection.Module, System.Type, System.Boolean)
    System.Attribute.GetCustomAttribute(System.Reflection.Module, System.Type)
    System.Attribute.GetCustomAttribute(System.Reflection.Module, System.Type, System.Boolean)
    System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Type)
    System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Type, System.Boolean)
    System.Attribute.GetCustomAttributes(System.Reflection.Assembly)
    System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Boolean)
    System.Attribute.IsDefined(System.Reflection.Assembly, System.Type)
    System.Attribute.IsDefined(System.Reflection.Assembly, System.Type, System.Boolean)
    System.Attribute.GetCustomAttribute(System.Reflection.Assembly, System.Type)
    System.Attribute.GetCustomAttribute(System.Reflection.Assembly, System.Type, System.Boolean)
    System.Attribute.Equals(System.Object)
    System.Attribute.GetHashCode()
    System.Attribute.Match(System.Object)
    System.Attribute.IsDefaultAttribute()
    System.Attribute.System.Runtime.InteropServices._Attribute.GetTypeInfoCount(System.UInt32)
    System.Attribute.System.Runtime.InteropServices._Attribute.GetTypeInfo(System.UInt32, System.UInt32, System.IntPtr)
    System.Attribute.System.Runtime.InteropServices._Attribute.GetIDsOfNames(System.Guid, System.IntPtr, System.UInt32, System.UInt32, System.IntPtr)
    System.Attribute.System.Runtime.InteropServices._Attribute.Invoke(System.UInt32, System.Guid, System.UInt32, System.Int16, System.IntPtr, System.IntPtr, System.IntPtr, System.IntPtr)
    System.Attribute.TypeId
    System.Object.ToString()
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Syncfusion.Windows.PropertyGrid
    Assembly: Syncfusion.PropertyGrid.Wpf.dll
    Syntax
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property, AllowMultiple = true)]
    public class MaskAttribute : Attribute, _Attribute

    Constructors

    MaskAttribute(String)

    Initializes a new instance of the MaskAttribute class with input mask.

    Declaration
    public MaskAttribute(string mask)
    Parameters
    Type Name Description
    System.String mask

    The input mask for property.

    Examples
    // Built-In mask to get valid email id from user.
     [MaskAttribute(MaskAttribute.EmailId)]
     public string EmailId { get; set; }
    
    // Custom mask to get valid email id from user.
     [MaskAttribute("[A-Za-z0-9._%-]+@[A-Za-z0-9]+.[A-Za-z]{2,3}")]
     public string EmailId { get; set; }  

    MaskAttribute(String, String)

    Initializes a new instance of the MaskAttribute class with input mask.

    Declaration
    public MaskAttribute(string mask, string propertyName)
    Parameters
    Type Name Description
    System.String mask

    The input mask for property.

    System.String propertyName

    The name of the property

    Examples
    // Built-In mask to get valid email id from user.
    [MaskAttribute(MaskAttribute.EmailId, "EmailId")]
    public class Employee
    {
       public string EmailId { get; set; }
    } 

    Fields

    Alphanumeric

    Gets the Regular expression for alpha numeric.

    Declaration
    public const string Alphanumeric = "[a-zA-Z0-9]*"
    Field Value
    Type Description
    System.String

    Binary

    Gets the Regular expression for binary.

    Declaration
    public const string Binary = "[01]*$"
    Field Value
    Type Description
    System.String

    CardNumber

    Gets the Regular expression for card number.

    Declaration
    public const string CardNumber = "\\d{4}-\\d{4}-\\d{4}-\\d{4}"
    Field Value
    Type Description
    System.String

    EmailId

    Regular expression to get valid email id from user.

    Declaration
    public const string EmailId = "[A-Za-z0-9._%-]+@[A-Za-z0-9]+.[A-Za-z]{2,3}"
    Field Value
    Type Description
    System.String

    Fraction

    Gets the Regular expression for fraction.

    Declaration
    public const string Fraction = "\\d*\\/\\d*"
    Field Value
    Type Description
    System.String

    HexaDecimal

    Gets the Regular expression for hexa decimal.

    Declaration
    public const string HexaDecimal = "\\\\x[0-9A-Fa-f]{1,2}"
    Field Value
    Type Description
    System.String

    IPv4

    Gets the Regular expression for IPv4.

    Declaration
    public const string IPv4 = "\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}"
    Field Value
    Type Description
    System.String

    IPv6

    Gets the Regular expression for IPv6.

    Declaration
    public const string IPv6 = "[0-9A-F]{4}:[0-9A-F]{4}:[0-9A-F]{4}:[0-9A-F]{4}:[0-9A-F]{4}:[0-9A-F]{4}:[0-9A-F]{4}:[0-9A-F]{4}"
    Field Value
    Type Description
    System.String

    MobileNumber

    Regular expression to get valid email id from user.

    Declaration
    public const string MobileNumber = "\\(?\\d{3}\\)?-? *\\d{3}-? *-?\\d{4}"
    Field Value
    Type Description
    System.String

    Number

    Gets the Regular expression for number.

    Declaration
    public const string Number = "\\d*"
    Field Value
    Type Description
    System.String

    Octal

    Gets the Regular expression for octal.

    Declaration
    public const string Octal = "\\\\0[0-7]{1,3}"
    Field Value
    Type Description
    System.String

    PositiveNumber

    Gets the Regular expression for positive number.

    Declaration
    public const string PositiveNumber = "\\d+"
    Field Value
    Type Description
    System.String

    ProductKey

    Gets the Regular expression for product key.

    Declaration
    public const string ProductKey = "[A-Z\\d]{5}-[A-Z\\d]{5}-[A-Z\\d]{5}-[A-Z\\d]{5}-[A-Z\\d]{5}"
    Field Value
    Type Description
    System.String

    Properties

    Mask

    Gets or sets the input mask of MaskEditor, which is used to restrict and format input data.

    Declaration
    public string Mask { get; set; }
    Property Value
    Type Description
    System.String
    Remarks

    Provide regular expression as input mask, where user will be allowed to enter input that meets the expression. To know about regular expression, please refer https://docs.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-language-quick-reference. Build-In mask are also available as constants, you can use it directly from MaskAttribute

    Examples
    // Built-In mask to get valid email id from user.
    [MaskAttribute(MaskAttribute.EmailId, "EmailId")]
    public class Employee
    {
      public string EmailId { get; set; }
    }
    
    // Built-In mask to get valid email id from user.
    [MaskAttribute(MaskAttribute.EmailId)]
    public string EmailId { get; set; }
    
    // Custom mask to get valid email id from user.
    [MaskAttribute("[A-Za-z0-9._%-]+@[A-Za-z0-9]+.[A-Za-z]{2,3}")]
    public string EmailId { get; set; }

    PropertyName

    Gets or sets the property name to which MaskEditor will be applied.

    Declaration
    public string PropertyName { get; set; }
    Property Value
    Type Description
    System.String
    Examples
     // Built-In mask to get valid email id from user.
     [MaskAttribute(MaskAttribute.EmailId, "EmailId")]
     public class Employee
     {
       public string EmailId { get; set; }
     }

    Implements

    System.Runtime.InteropServices._Attribute
    Back to top Generated by DocFX
    Copyright © 2001 - 2022 Syncfusion Inc. All Rights Reserved