I have List View in Main-Page. I am using template selector to choose the templates which are resides in separate files(ViewCell). Now I need to use a list view in the selected template(separate file), but it gives run-time error and I am not able to get what is the error also. Below is the code snippet.
MainPage
<ListView Margin="0,0,0,0" VerticalOptions="FillAndExpand"
SeparatorVisibility="None" HasUnevenRows="True"
ItemTemplate="{StaticResource RequestTemplateSelector }"
ItemsSource="{Binding LstInventoryRequests}" >
</ListView>
LstInventoryRequests(List of below class object)
Class
{
public string IssuedOn { get; set; }
public string IssueId { get; set; }
public ObservableCollection<InventoryDetailItemData> ItemDetails { get; set; }
}
InventoryDetailItemData
public string ItemName { get; set; }
public int RequestedQty { get; set; }
public int IssuedQty { get; set; }
Inside ViewCell(Separate file) being selected by templateselector
<ListView
SeparatorVisibility="None"
ItemsSource="{Binding ItemDetails}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell >
<ViewCell.View>
<Label Text="{Binding ItemName}"/>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
It gives me Run-time error and not able to find what is the issue in the above code. Can someone please help me finding it out?