WPF Context menu on left click

后端 未结 8 502
情深已故
情深已故 2020-12-01 10:39

I have a WPF application..In which I have an Image control in Xaml file.

On right click of this image I have a context menu.

I would like to have same to be

8条回答
  •  情歌与酒
    2020-12-01 11:25

    you can bind the Isopen Property of the contextMenu to a property in your viewModel like "IsContextMenuOpen". but the problem is your can't bind directly the contextmenu to your viewModel because it's not a part of your userControl hiarchy.So to resolve this you should bing the tag property to the dataontext of your view.

    
    
    .....
    
    
    

    Good luck.

提交回复
热议问题