View a list of Windows phones
I created a Windows Phone 8.1 app with a listing at Startpage.xaml. When I update the list values, I don't see the changes on the phone until I close and open the app again. I tried to refresh the list when I clicked the refresh button, with no success. Does anyone know how to update the list when I click the refresh button?
How I populate the data in the list:
protected async override void OnNavigatedTo(NavigationEventArgs e)
{
this.navigationHelper.OnNavigatedTo(e);
HttpClient http = new HttpClient();
string str = ((ComboBoxItem)cbox.SelectedItem).Content.ToString();
var response = await http.GetStringAsync("http://mywebpage.si/events/apis/facebook_events.php?city=" + str + "&user=" + uporabnik.user);
var FSfeed = JsonConvert.DeserializeObject<List<Class1>>(response);
Reviews.ItemsSource = FSfeed;
}
My class:
public class Class1
{
public string title { get; set; }
public string description { get; set; }
public string image { get; set; }
public string start { get; set; }
public string end { get; set; }
public string location { get; set; }
public string city { get; set; }
public int id { get; set; }
}
Refresh button:
private async void refresh_Click(object sender, RoutedEventArgs e)
{
HttpClient http = new HttpClient();
string str = ((ComboBoxItem)cbox.SelectedItem).Content.ToString();
var response = await http.GetStringAsync("http://mywebpage.si/events/apis/facebook_events.php?city=" + str + "&user=" + uporabnik.user);
var FSfeed = JsonConvert.DeserializeObject<List<Class1>>(response);
Reviews.ItemsSource = FSfeed;
}
I also tried to update this, but without success:
private async void refresh_Click(object sender, RoutedEventArgs e)
{
this.Frame.Navigate(typeof(PivotPage));
}
+3
source to share