Question

What is the correct way to show the selected object of a property Grid?

In Visual Studio they use a combobox. Is there a default setting that I can change to enable this or something like it?

Short Video Explanation: http://youtu.be/uI5crr_9hZA

No correct solution

OTHER TIPS

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);
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top