Game Development Reference
In-Depth Information
The [ DefaultPropertyAttribute] specifies the name of the property that will act as the
default property for the PropertyGrid .[ CategoryAttribute] specifies the name of the
category that the property is located in. Categories are automatically created based
on these names. The [ DescriptionAttribute] specifies the description text that appears
at the bottom of the PropertyGrid when a property is selected. The TypeConverter
and PropertyOrder attributes will be covered in the next section. You can create
read-only properties simply by providing a get construct. You can also hide prop-
erties from showing up in the PropertyGrid by using a [ Browsable(false)] attribute.
The following code shows an example of a bindable class that can be visualized
and modified using the PropertyGrid control. Notice the attributes that are used to
specify names, descriptions, and ordering for the visualized properties.
public enum Gender
{
Male,
Female,
Unspecified
}
public enum Position
{
Programmer,
Tester,
Director,
Architect,
Analyst,
Unspecified
}
[TypeConverter(typeof(PropertyOrderConverter)),
DefaultPropertyAttribute(“FirstName”)]
public class PersonnelRecord
{
// Contact Information
private string firstName;
private string lastName;
private string phoneNumber;
private string email;
// Biological Information
private DateTime birthDate;
Search Nedrilad ::




Custom Search