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

BindingContext problem with a ListView

$
0
0

I have a StackLayout which displays the selected item from a ListView. The way I did this is that I set the BindingContext of the StackLayout to ListView's ItemSelected. However, I want the binding to be to a Property of the whole layout called Container, and selecting an item in the ListView should simply change the Container property, thus changing all the elements inside the StackLayout. When I do this, it doesn't work. All the labels in the StackLayout are empty after I click on a ListView element, and the Container is set to a new value.
When I initialize the page, I set the Container to be the FirstOrDefault of the ObservableCollection which is the ItemsSource for the ListView (I'm sorry I can't place any code at the moment, but it's way too unorganized for me to show it and make it understandable). At first, the StackLayout displays the first element of the list properly, but when I pick another element, it stops working.

Can you help me?


Viewing all articles
Browse latest Browse all 91519

Trending Articles



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