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

ListView BindingContext issue

$
0
0

There seems to be an issue with the setting of the BindingContext on ViewCells within a ListView.

Specifically, if you have explicitly set a BindingContext on an element in the visual tree that is an ancestor of the ListView, and the ListView contains items of type 'FOO', the BindingContext on each ViewCell will be set twice - once to the BindingContext from the ancestor element and a second time to the proper BindingContext for the ViewCell, i.e. an instance of 'FOO'.

This ends up generating binding errors when you define your ViewCell DataTemplate in XAML since the first BindingContext change involves an instance of an unexpected type and the bindings on elements within the DataTemplate cannot be resolved resulting in binding errors. Once the second BindingContext change happens the bindings are properly resolved since the context is of the expected type. However at this point performance has already been impacted due to the binding errors.

Anyone else seeing this?


Viewing all articles
Browse latest Browse all 58056

Trending Articles