public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // thePen = new Pen(System.Drawing.Color.Black); penProps = new PenProperties(thePen); penProps.PropertyChanged += new EventHandler(this.OnPenPropertyChangedEventHandler); propertyGrid1.SelectedObject = penProps; propertyGrid1.Refresh(); } public class PenProperties { //Implementation members private System.Drawing.Pen thePen; private System.Drawing.Icon icon; //Events public event EventHandler PropertyChanged; //Properties [Description("The colour associated with the control"),Category("Appearance")] public System.Drawing.Color Color { get { return thePen.Color; } set { thePen.Color = value; OnPropertyChanged( new EventArgs( ) ); } } public System.Drawing.Drawing2D.DashCap DashCap { get { return thePen.DashCap; } set { thePen.DashCap = value; OnPropertyChanged( new EventArgs( ) ); } } public System.Drawing.Drawing2D.DashStyle DashStyle { get { return thePen.DashStyle; } set { thePen.DashStyle = value; OnPropertyChanged( new EventArgs( ) ); } } public float Width { get { return thePen.Width; } set { thePen.Width = value; OnPropertyChanged( new EventArgs( ) ); } } public float DashOffset { get { return thePen.DashOffset; } set { thePen.DashOffset = value; OnPropertyChanged( new EventArgs( ) ); } } public System.Drawing.Drawing2D.LineCap StartCap { get { return thePen.StartCap; } set { thePen.StartCap = value; OnPropertyChanged( new EventArgs( ) ); } } public System.Drawing.Drawing2D.LineCap EndCap { get { return thePen.EndCap; } set { thePen.EndCap = value; OnPropertyChanged( new EventArgs( ) ); } } public System.Drawing.Icon Icon { get { return icon; } set { icon = value; } } public PenProperties(Pen p) { thePen = p; thePen.EndCap = EndCap; thePen.Color = System.Drawing.Color.Black; } protected void OnPropertyChanged( EventArgs e ) { if( PropertyChanged != null ) PropertyChanged( this, e ); } } }The downside to doing this is you may end up with lots of different classes doing similiar things scattered about your code base. As an alternative you could engineer some type of collection class that implements the following interface.
System.ComponentModel.ICustomTypeDescriptorThis interface will allow your collection class to publish customised type information to the property grid in a more generic fashion. This would take a lot more effort to implement but it would provide a better solution to your problem.