none
WPF context menu in Forms context menu RRS feed

  • Question

  • Is it possible to have a WPF context menu inside a Forms context menu?

    I want to do this because I want to do some graphics not available in Forms.
    Tuesday, May 12, 2009 8:33 AM

Answers

  • I am sorry I was not specific enough (I have used Elementhost a lot in forms but I cannot see how it should be possible in a menu).

    This is an example of what I want (it is a context menu):

    FormsContextMenu-->FormsContextMenu-->WPFContextMenu

    Such that the Forms menuitem opens a WPFContextMenu.
    Winform ContextMenu can not accept ElementHost.
    So you can not put a WPF ContextMenu into a Winform ContextMenu.
    • Proposed as answer by Tao Liang Friday, May 15, 2009 6:34 AM
    • Marked as answer by Tao Liang Monday, May 18, 2009 1:57 AM
    Friday, May 15, 2009 6:34 AM

All replies

  • If you want to host WPF elements in a WinForm window, you could use System.Windows.Forms.Integration.ElementHost.

    For more detailed information, you could refer to:
    http://msdn.microsoft.com/en-us/library/system.windows.forms.integration.elementhost.aspx
    • Proposed as answer by Tao Liang Tuesday, May 12, 2009 9:10 AM
    • Unproposed as answer by MEK_DK Tuesday, May 12, 2009 10:26 AM
    Tuesday, May 12, 2009 9:10 AM
  • I am sorry I was not specific enough (I have used Elementhost a lot in forms but I cannot see how it should be possible in a menu).

    This is an example of what I want (it is a context menu):

    FormsContextMenu-->FormsContextMenu-->WPFContextMenu

    Such that the Forms menuitem opens a WPFContextMenu.
    Tuesday, May 12, 2009 9:31 AM
  • I am sorry I was not specific enough (I have used Elementhost a lot in forms but I cannot see how it should be possible in a menu).

    This is an example of what I want (it is a context menu):

    FormsContextMenu-->FormsContextMenu-->WPFContextMenu

    Such that the Forms menuitem opens a WPFContextMenu.
    Winform ContextMenu can not accept ElementHost.
    So you can not put a WPF ContextMenu into a Winform ContextMenu.
    • Proposed as answer by Tao Liang Friday, May 15, 2009 6:34 AM
    • Marked as answer by Tao Liang Monday, May 18, 2009 1:57 AM
    Friday, May 15, 2009 6:34 AM