So I'm trying to change frames in a windows 8 app. I tried following the tutorial at this page, but I keep getting the same error.
I'm getting an ArgumentNullException on the line:
frameState[_pageKey] = pageState;
in the LayoutAwarePage.cs class, in the OnNavigatedFrom method.
Now I'm not sure why I get this error, because I feel that there is nothing that could cause it in my code. My button onclick function has this code:
DateTime chosenDateTime = new DateTime(year, month, day, hours, minutes, seconds);
this.Frame.Navigate(typeof(MainPage), chosenDateTime.ToString());
And the OnNavigatedTo method in my MainPage looks like this:
protected override void OnNavigatedTo(NavigationEventArgs e) {
string parameter = (string)e.Parameter;
if (parameter != "") {
Windows.Storage.ApplicationDataContainer roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings;
roamingSettings.Values["chosenDateTime"] = parameter;
chosenDateTime = Convert.ToDateTime(e.Parameter);
} else {
Windows.Storage.ApplicationDataContainer roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings;
if (roamingSettings.Values.ContainsKey("chosenDateTime")) {
chosenDateTime = Convert.ToDateTime(roamingSettings.Values["chosenDateTime"].ToString());
}
if (roamingSettings.Values.ContainsKey("headline")) {
chosenDateTextBlock.Text = roamingSettings.Values["headline"].ToString();
}
}
SetTime();
}
Can anyone give me some information as to how I can solve this?
Thanks.