Property Attributes

  • 2 minutes to read

The PropertyGrid control recognizes property attributes specified in the model.

Property attributes allow you to configure the appearance and behavior of the PropertyGrid control on the model level. To use property atributes in your project, reference the System.ComponentModel namespace.

The following example demonstrates the property attribute syntax.

using System.ComponentModel;
[TypeConverter(typeof(ExpandableObjectConverter)), Description("Customer's address")]
public SimpleAddress Address { get; set; }

The following table lists some of the property attributes recognized by the PropertyGrid control.




Specifies whether the property is displayed within the property grid.


Specifies the property’s category.

To learn more, see Property Categories.


Specifies the property’s default value.


Specifies the property’s description.

To learn more, see Property descriptions.


Specifies the property’s display name.


Specifies whether the property is read-only.


Specifies a type converter for the property.

To learn more, see Expandability Customization.


Specifies a type converter’s destination type.


Specifies an instance initializer for the property.

To learn more, see Collection Definitions.

The following example demonstrates the use of various property attributes.

using System.Collections.Generic;
using System.ComponentModel;
public class Customer {
    [Browsable(false), ReadOnly(true)]
    public int ID { get; set; }
    [Category("Customer Info"), Description("Customer's full name")]
    public string Name { get; set; }
    [Category("Contact"), Description("Customer's email address")]
    public string Email { get; set; }
    [Category("Contact"), Description("Customer's phone number")]
    public string Phone { get; set; }
    [Category("Order Info"), Description("Ordered items"), DisplayName("Ordered Items")]
    public ProductList Products { get; set; }

public class Book {
    public int ID { get; set; }
    public string Author { get; set; }
    public string Title { get; set; }
    public double Price { get; set; }

public class ProductList : List<Object> {
    public ProductList() : base() { }
    public override string ToString() {
        return "Product List";
public class ViewModel {
    public Customer DemoCustomer { get; set; }
    public ViewModel() {
        DemoCustomer = new Customer()
            ID = 0,
            Name = "Anita Benson",
            Email = "",
            Phone = "7138638137",
            Products = new ProductList {
                new Book
                    ID = 47583,
                    Author = "Arthur Cane",
                    Title = "Digging deeper",
                    Price = 14.79
<dxprg:PropertyGridControl SelectedObject="{Binding DemoCustomer}"/>


See Also