Quantcast
Viewing latest article 17
Browse Latest Browse All 39

Answer by Yura Babiy for Bind properties to elements inside a Listview DataTemplate

BindingContext, in other words "ItemsSource" for listview, is appliying to whole listview, include DataTemplate. So, if you wanna bind something, then it property should be in BindingContext, in your case it is Patients. So, Pasient class should include this property. But, there is a trick. Where you want bind something, that is not in listview binding context, then you should name your listview, like x:Name = "YourListView" and then in your datatemplate for your binding write this:

Property="{Binding Source={x:Reference Name = "YourListView"},          Path=BindingContext.YourNameOfPropertyInViewModel}"

With this, your property will use binding context of your listview element level, that is ViewModel in your case.


Viewing latest article 17
Browse Latest Browse All 39

Trending Articles