wpf - Button touchDown and Button touchUp events -


i'm developing windows universal app (windows 8.1 + winwdows phone 8.1). can detect click event on button doing:

<button x:name="menubutton" click="menubutton_click" /> 

i'd detect "press" event , "release" event on button. when button pressed have change image in app. when button released image returns init state. checked methods related button class, seems there's nothing me. thank in advance.

you have implement it, this

public class mybutton : button {     public event routedeventhandler mypointerpressed;     public event routedeventhandler mypointerreleased;     public event routedeventhandler mypointerexited;     public event routedeventhandler mypointermoved;      public event eventhandler holdingstarted;      protected override void onpointerpressed(pointerroutedeventargs e)     {         base.onpointerpressed(e);          mypointerpressed?.invoke(this, e);     }      protected override void onpointermoved(pointerroutedeventargs e)     {         base.onpointermoved(e);          mypointermoved?.invoke(this, e);     }      protected override void onpointerreleased(pointerroutedeventargs e)     {         base.onpointerreleased(e);          mypointerreleased?.invoke(this, e);     }      protected override void onpointerexited(pointerroutedeventargs e)     {         base.onpointerexited(e);          mypointerexited?.invoke(this, e);     }      protected override void onholding(holdingroutedeventargs e)     {         if (e.holdingstate == holdingstate.started)         {             holdingstarted?.invoke(this, new eventargs());             return;         }          base.onholding(e);     } } 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -