MemberDesignTimeVisibilityAttribute Class
Specifies whether a property or class is visible at design time.
Namespace: DevExpress.Xpo
Assembly: DevExpress.Xpo.v24.1.dll
NuGet Packages: DevExpress.Win.PivotGrid, DevExpress.Win.TreeMap, DevExpress.Xpo
NuGet Package: DevExpress.Xpo
Declaration
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.
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); }
}
}