WPF TextBlock 双击命令
TextBlock使用EventTrigger触发命令,只能使用MouseLeftButtonDown或者MouseLeftButtonUp触发,要实现鼠标双击触发命令,可以使用InputBinding,具体代码如下
<TextBlock> <TextBlock.InputBinding> <MouseBinding MouseAction="LeftDoubleClick" Command="{Binding DoubleClickCommand}" CommandParameter="{Binding }"/> </TextBlock.InputBinding> </TextBlock>