Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

XAML Issue with Gestures on controls bound to objects of MVVM (Sample project included)

$
0
0

I'm having an issue where GestureRecognizers in XAML pages aren't firing when their containing control is bound to an object of a ViewModel. It seems as if setting the BindingContext of a label to an object breaks the GestureRecognizers bound to that label. Note that this issue only occurs when the bindingContext is set to a child object of the VM, and the Text is set to a property of the bound child object. It does not occur when the Text bound to a direct property of the VM or with static text. Also, this issue does not occur with cs files.

I've created a sample project which illustrates the issue. The project contains two pages. One is a XAML page, the other is a CS page. Both pages contain three labels a gestureRecognizer attached to each label.

The first label has hard coded text. Xaml: Works CS: Works
The second label is bound to a Employee object within the VM, and text displays the Phone property of the Employee object. Xaml: Doesn't fire CS: Works
The third label is bound to a property of the VM. Xaml: Works CS: Works

Notes:
This has only been tested on ios 9.2
I am using Xlabs.Form's MVVM (version 2.0.5782)
I'm using the latest stable Xamarin nuget packages

Thanks for your help!


Viewing all articles
Browse latest Browse all 75885

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>