So, I'm trying to change the frames in a Windows 8 application. I tried to complete the tutorial on this page , but I still get the same error.
I get an ArgumentNullException in 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 in my code that could cause it. My onclick button 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 someone give me some information on how I can solve this?
Thanks.
Loyalar
source share