wpf - How to use Interaction Trigger on button with MouseUp and MouseDown events in XAML? -


i have button needs execute 2 separate commands (one start , 1 stop it). after doing research system.windows.interactivity.dll seemed provide easy way accomplish this. doesn't work left mouse button (it work if use event mousedoubleclick or mouserightbuttondown, not mousedown, mouseup, or mouserightbuttondown)...it seems if button consumes event , interaction.trigger never sees it. provided snippet of xaml below, can around behavior?

<button content="dostuff">     <i:interaction.triggers>         <i:eventtrigger eventname="mousedown">             <i:invokecommandaction command="{binding startcommand}" />         </i:eventtrigger>         <i:eventtrigger eventname="mouseup">             <i:invokecommandaction command="{binding stopcommand}" />         </i:eventtrigger>     </i:interaction.triggers> </button> 

you can use previewmousedown , previewmouseup instead


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -