I am trying to pass the information from a listview to a popup form and I can see the data sitting in SelectedItem and unable to get it out. Thanks for your help.
<ListView HeightRequest="150" x:Name="listPost" ItemsSource="{Binding myRatingList}" ItemSelected="OnOpenRatingPupup">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Orientation="Horizontal">
<Label Text="{Binding ScoreDesc}" x:Name="lblScoreDesc" TextColor="Black" Margin="8,0,0,0" VerticalTextAlignment="Center"></Label>
<StackLayout HorizontalOptions="EndAndExpand" VerticalOptions="Center">
<rating:RadShapeRating x:Name="xRating" Value="{Binding Value}" IsEnabled="false"></rating:RadShapeRating>
</StackLayout>
<Label Text="{Binding Comment}" x:Name="lblComment" TextColor="Black" Margin="8,0,0,0"></Label>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
.cs file - dataItem is null
public class postlist_model {
public string Comment { get; set; }
public string ScoreDesc { get; set; }
public string Value { get; set; }
}
private async void OnOpenRatingPupup(object sender, SelectedItemChangedEventArgs e)
{
if (e.SelectedItem == null) {
return;
}
var dataItem = e.SelectedItem as postlist_model;
if (dataItem == null) {
return;
}
var page = new RatingsPopup(InTradeShowID, "Booth Site", "1");
await Navigation.PushPopupAsync(page);
}
If I preview e.SelectedItem it lists the values Comment=""; ScoreDesc="Booth Site", Value="0".