Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Updating a property which is bound to in XAML in an event handler

$
0
0

Hi,

I am updating multiple properties which are bound to in an XAML ListView but I am doing the updating in an AsyncCompleteEventHandler. I get a data from a web service and upon completion I create a list with the data retrieved. It works great until I navigate back a page, then come back to this page to do it again it crashes every time with no error. Here is code:

private void Client_Completed(object sender, Service.CompletedEventArgs e)
{
if(e.Error != null)
{
DisplayAlert("Error", "Unable to retrieve logs at this time.", "OK");
}
else
{
// get all the of the logs
foreach (var item in e.Result)
{
logs.Add(new Log()
{
Job = item.Job,
//ListView <ImageCell.Text> is bound to this
Timestamp = item.DateTime.ToString(),
Type = item.Type,
// ListView <ImageCell.ImageSource> is bound to this
ImgSrc = ImageSource.FromUri(new Uri(item.ImagePath))
});
}
}
}

This works the first time I navigate to the page that does this, but when I click the back button and go back to a previous page and then come back to this page to do it again it crashes, any thoughts?


Viewing all articles
Browse latest Browse all 204402

Latest Images

Trending Articles



Latest Images

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