views:

31

answers:

1

How do I show a PropertyGrid instead of a context menu, so when the user clicks somewhere else, it will hide (like a context menu)?

+2  A: 

You could wire the loss of focus to this action. It's not perfect (not all clicks outside the control will be captured), but it will work every time another control grabs focus.

propertyGrid1.Leave += (object sender, EventArgs e) => { propertyGrid1.Hide(); };

If this is not good enough, you could try wiring the action to other events, such as the form's Click event.

Ani