How to send a list of object from my MainPage.xaml to another page

Posted by LivingThing on Stack Overflow See other posts from Stack Overflow or by LivingThing
Published on 2013-10-20T15:50:58Z Indexed on 2013/10/20 15:53 UTC
Read the original article Hit count: 379

Filed under:
|
|

When navigating to another page how can i make my list of object available to another page.

for example in my mainpage.xaml

var data2 = from query in document.Descendants("weather")
           select new Forecast
           {
                date = (string)query.Element("date"),
                tempMaxC = (string)query.Element("tempMaxC"),
                tempMinC = (string)query.Element("tempMinC"),
                weatherIconUrl = (string)query.Element("weatherIconUrl"),
            };

forecasts = data2.ToList<Forecast>();
....
NavigationService.Navigate(new Uri("/WeatherInfoPage.xaml", UriKind.Relative));

and then in my other class, i want to make it available so that i can use it like this

private void AddPageItem(List<Forecast> forecasts)
{
    ..
}

© Stack Overflow or respective owner

Related posts about c#

Related posts about wpf