Saturday, March 6, 2010

Context menu

Due to the WPF Interop Airspace rule that mainly specifies that different technology areas like WPF and OpenGL shouldn't overlap we had problems when the WPF ribbon menus were extending over the OpenCascade drawing area. An initial solution was to do a trick to put a transparent WPF overlay over the OpenGL area.

This trick wasn't solving properly our need to display right click menu, the WPF content was flickering and sometimes disappearing. After many changes at the Overlay layer found an interesting issue that actually when all code from Overlay removed the Ribbon menu is still drawn over the OpenCascade content due to the fact that Overlay is derived from Decorator class. Another problem is that mouse events are consumed by the OpenCascade control and they don't reach the WPF layer.

Will continue working at this issue to solve the context menu problem. Probably the final solution will be to display an WindowsForms Context menu over the OpenCascade user control. The mouse events will be processed there also for the context menu so there will be no need to do hacks to pass mouse events to WPF layer.

No comments: