Back to Devexpress

MemberDesignTimeVisibilityAttribute Class

xpo-devexpress-dot-xpo-3614fa2d.md

latest3.1 KB
Original Source

MemberDesignTimeVisibilityAttribute Class

Specifies whether a property or class is visible at design time.

Namespace : DevExpress.Xpo

Assembly : DevExpress.Xpo.v25.2.dll

NuGet Package : DevExpress.Xpo

Declaration

csharp
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field, Inherited = true)]
public sealed class MemberDesignTimeVisibilityAttribute :
    Attribute
vb
<AttributeUsage(AttributeTargets.Class Or AttributeTargets.Property Or AttributeTargets.Field, Inherited:=True)>
Public NotInheritable Class MemberDesignTimeVisibilityAttribute
    Inherits Attribute

Remarks

The MemberDesignTimeVisibilityAttribute attribute specifies whether a class or property is marked as visible by default. This attribute affects the collection’s behavior while it is bound to a control (see the example).

Example

The following example shows how to mark the Age property as hidden at design time. For this purpose the MemberDesignTimeVisibilityAttribute is used. When binding the xpCollection1 class to the XtraGrid control, grid columns are automatically created for displayable properties. As a result the column for the Age property isn’t created.

csharp
using DevExpress.Xpo;
// ...
class SampleTable : XPBaseObject {
    private int id;
    private string name;
    private int age;

    SampleTable(Session session) : base(session) {
        this.name = "John";
        this.age = 25;
    }

    [Key(true)]
    public int ID {
        get { return id; }
        set { SetPropertyValue<int>(nameof(ID), ref id, value); }
    }
    public string Name {
        get { return name; }
        set { SetPropertyValue<string>(nameof(Name), ref name, value); }
    }
    [MemberDesignTimeVisibility(false)]
    public int Age {
        get { return age; }
        set { SetPropertyValue<int>(nameof(Age), ref age, value); }
    }
}

Inheritance

Object Attribute MemberDesignTimeVisibilityAttribute

See Also

MemberDesignTimeVisibilityAttribute Members

IsVisibleInDesignTime

BrowsableAttribute Class

Built-In Attributes

Data Annotation Attributes

DevExpress.Xpo Namespace