标签:
1 <Button CommandParameter="{Binding}" 2 Tag="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type pagesView:OutputPage}}}" 3 Command = "{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type pagesView:OutputPage}}, Path=DataContext.EditOutputCommand}"> 4 <Button.ContextMenu> 5 <ContextMenu> 6 <MenuItem Header="削除" 7 CommandParameter="{Binding}" 8 Command="{Binding Path=PlacementTarget.Tag.DataContext.DeleteCurrentLineCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/> 9 </ContextMenu> 10 </Button.ContextMenu> 11 </Button>
button.contextmenu的command 失效;
参考地址:http://stackoverflow.com/questions/9994241/mvvm-binding-command-to-contextmenu-item
MVVM datatemplate 下button.contextmenu的command 失效解决方案
标签:
原文地址:http://www.cnblogs.com/codeinet/p/4807151.html