In Visual Studio, the Properties
windows is actually a pane having ComboBox
and PropertyGrid
controls (checked with UISpy
tool).
If you want to have similar functionality, you could add a ToolStripComboBox
to the PropertyGrid
toolbar using its controls collection. Add the object collection to this combo and in the SelectedIndexChanged
handler set the SelectedObject
of PropertyGrid
to the selected item in the combo.
Sample code:
ToolStripComboBox objectDropDown = new ToolStripComboBox();
foreach (Control item in propertyGrid1.Controls)
{
ToolStrip toolstrip = item as ToolStrip;
if (toolstrip != null)
{
toolstrip.Items.Add(objectDropDown);
}
}