C#商店应用程序,在基本页面返回按钮上发送参数
我制作了一个C#Store应用程序。我将参数发送到页面并读取它们,这一切都很好。我将参数发送到其他页面,如下所示:C#商店应用程序,在基本页面返回按钮上发送参数,c#,windows-store-apps,C#,Windows Store Apps,我制作了一个C#Store应用程序。我将参数发送到页面并读取它们,这一切都很好。我将参数发送到其他页面,如下所示: this.Frame.Navigate(typeof(ItemDetailPage), UniqueID); //(works) 我使用基本页面(因为它有一个默认的backbutton和title。现在我想将我发送到ItemDetailPage的参数(就像我在上面的示例中所做的那样)发送回我当前所在的页面,可能是返回按钮 当我返回到当前页面时,是否有人提出了如何保存/检索de值的
this.Frame.Navigate(typeof(ItemDetailPage), UniqueID); //(works)
我使用基本页面(因为它有一个默认的backbutton和title。现在我想将我发送到ItemDetailPage的参数(就像我在上面的示例中所做的那样)发送回我当前所在的页面,可能是返回按钮
当我返回到当前页面时,是否有人提出了如何保存/检索de值的解决方案
提前感谢。执行此操作有两种方法: 1) 将值存储在app.xaml.cs中定义的IsolatedStorageSettings对象中,并将值存储在此对象中,然后在所需页面中检索。 例如:
public IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
store value like this :
(App.Current as App).settings.Add("sampledata", txtsomething.Text);
for retrive :
(string)(App.Current as App).settings["sampledata"];
and whenever you want to update the data just remove the value inside this and then add again.
2) 在app.xaml.cs中添加变量并在任何地方访问它 将该值存储在公共静态属性中。