views:

488

answers:

1

So, I have a WindowsFormsHost control in my WPF app (hosting a Dundas Chart) and I want to put a ContextMenu on it.

I can successfully attach a ContextMenu to any normal WPF control, but it's not working for the WindowsFormsHost. I suspect this is becuase it's "special" in some way and the appropriate mouse messages aren't reaching the required destination.

How do I do this?

+1  A: 

Answering my own question - I have made this work by capturing the MouseDown event on my Windows control I'm hosting (the Dundas Chart control) and then firing a new event.

The event handler for the new event then does:

graph.ContextMenu.IsOpen = true;

Works nicely.

Craig Shearer
that's how I've done it too
qntmfred