Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2370
XamContextMenu inside ListBoxItem -- Unable to bind command to XamMenuItem
posted

If I use RelativeSource to get to the DataContext of the MainWindow, it doesn't work (binding errors about finding the source).

If I use ElementName to get to the DataContext of the MainWindow, same thing.

I also tried following this method to get at the correct DataContext: http://stackoverflow.com/questions/15033522/wpf-contextmenu-woes-how-do-i-set-the-datacontext-of-the-contextmenu.

See link below for a sample project showing my issue.  I have placed a breakpoint on the command, so all you need to do is left-click the "convert to" button to get the context menu to appear and then click "to text".  The breakpoint should be reached if the binding is correct.  The method that is used in the attached project uses the stackoverflow method, and doesn't have any binding errors, but the command is still not reached.

http://1drv.ms/1F2k5ZH

Thanks for the help!

Jon

Parents Reply Children