Game Development Reference
record.EmployeeId = 12345;
record.Position = Position.Programmer;
record.Probationary = false;
PropertyGridEditor.SelectedObject = record;
Running the code snippet that instantiates a PersonnelRecord with initial values and
binds it to the PropertyGrid will produce results similar to those shown in Figure 20.3.
Screenshot of the accompanying
The Companion Web site contains the full source code to the bindable class,
PropertyOrder type converter, and example usage.
This chapter discussed the implementation details around the PropertyGrid control
in the .NET framework. As mentioned before, the bulk of the implementation lies in
attribute decoration in the bindable class, since all you need do to use the PropertyGrid
is instantiate a PropertyGrid control and set the SelectedObject property to your
It should be noted that in this chapter I covered a large chunk of the implementation
details, but there was no coverage of localization of properties or the development
of custom type editors. Both subjects require a fair amount of explanation and code.
Feel free to visit MSDN to investigate these features.