Note that there are some explanatory texts on larger screens.

plurals
  1. POmvvmcross touch command binding in android
    text
    copied!<p>I'm looking for a way to do a "Touch" command binding between axml and ViewModel, or some else like FocusChanged etc.</p> <p>A simple "Click" command works fine like so: local:MvxBind="{'Touch':{'Path':'CameraButtonCommand'}}" /></p> <pre><code> public IMvxCommand CameraButtonCommand { get { return new MvxRelayCommand( () =&gt; { RequestNavigate&lt;AugRealityViewModel&gt;(true); }) ; } } </code></pre> <p>However, I've tried other event types for the controll(in this case it's ImageButton) and they are not being processed. When I've checked the events listings in the View Class I see those:</p> <pre><code> public event EventHandler Click; public event EventHandler&lt;View.CreateContextMenuEventArgs&gt; ContextMenuCreated; public event EventHandler&lt;View.FocusChangeEventArgs&gt; FocusChange; public event EventHandler&lt;View.KeyEventArgs&gt; KeyPress; public event EventHandler&lt;View.LongClickEventArgs&gt; LongClick; </code></pre> <p>Only Click event has the general EventHandler attached to it, while other have genericed EventHandlers, and I'm wondering if that's the reason why it doesn't work.</p> <p>I've also tried to attach a method to those events in the View class getting the proper control by FindViewById method and it works as expected this time around. But somehow I can't do it in the axml through Commands.</p> <p>Also one more thing. The "Click" event is sending the "EventArgs" object as one of the parameters, and also the object reference. I can see that with ease if I do this behaviour in View Class, but when I do this by binding, I don't see those arguments when I'm processing the Command in ViewModel.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload