阅读背景:

在ItemsControl.DataTemplate中为ContextMenu设置DataContext

来源:互联网 

I have custom control that is being used in data template for an ItemsControl. I want to put a ContextMenu on each item and have it call the UserControl's View Model to process the command. Using the XAML below, I can get click events on the custom control to call the SelectedItemCommand in the user control view model. But, using similar syntax for the context menu fails. By default I get the view mode per each custom control. Any of the RelativeSource syntax value I use don't resolve to the user control's view model (RelativeSource Self).I have custom control that is being used in dat




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: