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

ItemTemplate BindingContext

$
0
0

Has anyone had an issue with the ItemTemplate BindingContext NOT being set to an item in ItemsSource? I have the following code:

<ListView Grid.Row="0" Grid.Column="0" ItemsSource="{Binding MyItemCollection}">
        <ListView.ItemTemplate>
             <DataTemplate>
               <TextCell Text="{Binding ItemName}"/>
             </DataTemplate>
        </ListView.ItemTemplate>
  </ListView>

I get an error saying "ItemName" is not found on "MainViewModel" (Page's ViewModel). Why is TextCell's BindingContext not an item in "MyItemCollection" (ObservableCollection)?

Thanks


Viewing all articles
Browse latest Browse all 58056

Trending Articles



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