You must have an ObservableCollection and set ItemSource property to the collection, otherwise your listview does not know data to visualize
System.InvalidCastException: 'Specified cast is not valid. Xamarin.Forms

NeidennX
1
Reputation point
Hi Everyone ! i have this project in which i need to Retrieve a list of data, when i click the Retrieve Button, the app enters in break mode and shows me an error saying
System.InvalidCastException: 'Specified cast is not valid.'
Accroding to what i've found the issue is with the ListView
block, but im not quite sure, please find it here attached
<ListView x:Name="ListEstudiantes">
<ListView.ItemTemplate>
<DataTemplate>
<TextCell Text="{Binding Name}">
</TextCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
If you need a Demo please let me know!
{count} votes
Hi @Alessandro Caliaro im using
ItemTemplate
only, it is really necessary to useItemSource
? ive read the documentation about ListViews Here still doesnt says that we gotta use the ItemSource as a mandatory thing, also im following this tutorial over Here in order to create this app, since im really new at this.Hope you can help me.
Regards