wpf 利用mvvm模式下,实现相关行为,替换传统鼠标事件操作

 xmlns:b="http://schemas.microsoft.com/xaml/behaviors"


  <b:Interaction.Triggers>
      <b:EventTrigger EventName="MouseMove">
          <b:InvokeCommandAction Command="{Binding MouseMoveCommand}" PassEventArgsToCommand="True"/>
      </b:EventTrigger>
      <b:EventTrigger EventName="Drop">
          <b:InvokeCommandAction Command="{Binding DropCommand}" PassEventArgsToCommand="True"/>
      </b:EventTrigger>
      <b:EventTrigger EventName="DragOver">
          <b:InvokeCommandAction Command="{Binding DragOverCommand}" PassEventArgsToCommand="True"/>
      </b:EventTrigger>
      <b:EventTrigger EventName="DragLeave">
          <b:InvokeCommandAction Command="{Binding DragLeaveCommand}" PassEventArgsToCommand="True"/>
      </b:EventTrigger>
  </b:Interaction.Triggers>

你可能感兴趣的:(wpf)