wpf mvvm datagrid 中button绑定命令方法
<DataGridTemplateColumn Header="设备状态" IsReadOnly="True" Width="150">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<!--<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#007EFF" FontSize="16">
<Hyperlink Foreground="Blue" TextDecorations="None">
<TextBlock Tag="{Binding MonitorNoOfCheckItem}" Text="查看" FontSize="16" Cursor="Hand"/>
</Hyperlink>
</TextBlock>-->
<Button Content="查看" BorderThickness="0" Name="BtnView" Tag="{Binding MointorNo}" Background="Transparent" Foreground="#007EFF" Command="{Binding DataContext.CmdShowItemValues,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl}}" CommandParameter="{Binding ElementName=BtnView,Path=Tag}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>