Andrea Pigazzini
Andrea Pigazzini

Reputation: 357

Programmatically show PropertyGrid active control's editing control

I'll try to explain the effect I want to achieve. Basically, when user select a particular property (whose accepted values will be presented in a drop down) I'd like the dropdown to show IMMEDIATELY, without the need to click the drop down button. So far i'v been trying some weird/ugly solutions with no success (like trying to raise a MouseClick on the dropdown button...) so I hope there is a simpler/not-so-ugly one.

Upvotes: 1

Views: 412

Answers (1)

lee-m
lee-m

Reputation: 2267

Add the following code to an event handler for the SelectedGridItemChanged:

if(e.NewSelected.Label == "Your Property Name")
{
  SendKeys.Send("%{DOWN}");
}

This sends an ALT+DOWN key press combination which will show the drop-down list of values for the property.

Upvotes: 1

Related Questions