views:

30

answers:

1

It's pretty straightforward to add simple properties to a User Control that will appear in the desired categories in the Windows Forms designer, e.g.:

[Category("Appearance")]
public Color BackColor {
    get { return _textBox.BackColor; }
    set { _textBox.BackColor = value; }
}

What if I want to expose a more complex property, such as a collection of items of a type I define? I'm thinking something along the lines of the ListView.Items property, or the DataGridView.Columns property -- where the user of the control can access this complex property via a more specialized pop-up form (as opposed to a simple TextBox or ComboBox).

Even a simple nudge in the right direction would be much appreciated.

+3  A: 

The nudge is UITypeEditor, it allows you to create a custom editor for any kind of property, including collections. Many examples in the framework, keep Reflector handy.

Hans Passant
Thanks, just happened to stumble across this about the same time you posted this answer! Checking it out now...
Dan Tao
Worked like a charm, thanks for the nudge!
Dan Tao