Get owner of context menu in code

前端 未结 3 736
抹茶落季
抹茶落季 2020-12-15 03:56

I have a ContextMenu like this:


    
        
            


        
3条回答
  •  遥遥无期
    2020-12-15 04:36

    The visual tree for ContextMenus and Popups works a little differently. You can use ContextMenu.PlacementTarget to get the StackPanel. There is more information available on MSDN here: http://msdn.microsoft.com/en-us/library/system.windows.controls.contextmenu.placementtarget.aspx

提交回复
热议问题