简体   繁体   中英

Bind IsClosed property of context menu

I have project which implements MVVM pattern. I have WPF window which has reusable usercontrol in his xaml. UserControl consist of WPFDataGrid. Also DataGrid has ContextMenu. I want do some staff when context menu is closed. But ContextMenu class have not dependency property which give me ability to know is it close or not. I cannot farword his Close event to the ViewModel because I havent ViewModel object in the level of UserControl. I think that I can do this this using attached DependecyProperty and create IsClosed attached property for ContextMenu Class.

Question: How can do this with attached dependecy property or other approach using MVVM?

PS Code snippet is desirable

但是它确实有IsOpen :-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM