wpf MVVMLight的DataGrid绑定数据

数据绑定需要跟上下文绑定,并且将relativesource的ancestortype值设置为子窗口

 

<Button Content="弹窗" CommandParameter="{Binding}" Command="{Binding DataContext.DParaCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}" />

posted @ 2019-03-05 14:15  魑魅魍魉四天王  阅读(814)  评论(0编辑  收藏  举报