c# - Click activates command twice -


i have added commands buttons (so can add shortcuts wpf app).

<button x:name="mybutton"         command="{binding mycommand}"         click="mybutton_click" /> 

the app works fine shortcuts, noticed annoying: when click on 1 of these buttons, associated function gets called twice, once click event , once commandexecute.

private void mycommandexecute(object param) {     myfunction(); }  private void mybutton_click(object sender, eventargs e) {     myfunction(); } 

is there way stop that, or have check eventuality myself in code?

don't use click event, use command.

wpf buttons supposed use 1 or other, not both approaches @ same time (unless want 2 different things @ same time when clicked).


Comments