WPF DataGrid 按钮列 命令如何绑定鼠标按下与松开事件?如下并未成功,请懂的哥们指教。
<DataGridTemplateColumn Header="Jog-">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate DataType="model:AxisKeyValueItem">
<Button Content="Jog-" Width="60" Margin="5,0" Style="{StaticResource ButtonPrimary}">
<hc:Interaction.Triggers>
<hc:EventTrigger EventName="MouseDown">
<hc:EventToCommand Command="{Binding Path=DataContext.MoveJogReduceCommand, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" CommandParameter="{Binding }"></hc:EventToCommand>
</hc:EventTrigger>
<hc:EventTrigger EventName="MouseUp">
<hc:EventToCommand Command="{Binding Path=DataContext.MoveStopCommand, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" CommandParameter="{Binding }"></hc:EventToCommand>
</hc:EventTrigger>
</hc:Interaction.Triggers>
</Button>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>