//xaml <behavior:Interaction.Triggers> <behavior:EventTrigger EventName="MouseWheel" SourceObject="{Binding ElementName=img}"> <behavior:InvokeCommandAction Command="{Binding MouseWheelCmd}" PassEventArgsToCommand="True" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=MouseButton}}" > </behavior:InvokeCommandAction> </behavior:EventTrigger> </behavior:Interaction.Triggers> //cs private void InitCmds() { MouseWheelCmd =new DelCmd(MouseWheelCmdExecuted,MouseWheelCmdCanExecuted); } private bool MouseWheelCmdCanExecuted(object obj) { return true; } private void MouseWheelCmdExecuted(object obj) { var mouseWheelEventArgs=obj as MouseWheelEventArgs; if(mouseWheelEventArgs != null) { //TO DO } }
标签:MouseWheelCmdExecuted,CommandParameter,void,private,Command,mouseWheelEventArgs, From: https://www.cnblogs.com/Fred1987/p/18288835