Skip to main content
.NET 6.0+

MemberDesignTimeVisibilityAttribute Class

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

Namespace: DevExpress.Xpo

Assembly: DevExpress.Xpo.v24.1.dll

NuGet Package: DevExpress.Xpo

Declaration

[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field, Inherited = true)]
public sealed class MemberDesignTimeVisibilityAttribute :
    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.

MemberDTimeVisibility

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