Quantcast
Channel: User Yura Babiy - Stack Overflow
Viewing all articles
Browse latest Browse all 39

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

$
0
0

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 all articles
Browse latest Browse all 39

Trending Articles



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