<Page
x:Class="pc.NavigateExample.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBox x:Name="Input_TextBox" />
<Button x:Name="Save_Button" Click="Save_Button_Click" Content="Save"/>
</StackPanel>
</Grid>
</Page>
using Windows.Storage;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace pc.NavigateExample
{
public sealed partial class MainPage : Page
{
public MainPage() {
InitializeComponent();
var RoamingSettings = ApplicationData.Current.RoamingSettings;
if(RoamingSettings.Values.ContainsKey("paramter"))
Input_TextBox.Text =
RoamingSettings.Values["paramter"].ToString();
}
private void
Save_Button_Click(object sender, RoutedEventArgs e)
{
var RoamingSettings = ApplicationData.Current.RoamingSettings;
RoamingSettings.Values.Add("paramter",
Input_TextBox.Text);
}
}
}
If you want to instead store your settings locally than it's pretty much the same paradigm just use the LocalSetting dictionary instead.
using Windows.Storage;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace pc.NavigateExample
{
public sealed partial class MainPage : Page
{
public MainPage() {
InitializeComponent();
var LocalSettings = ApplicationData.Current.LocalSettings;
if(LocalSettings.Values.ContainsKey("paramter"))
Input_TextBox.Text = LocalSettings.Values["paramter"].ToString();
}
private void
Save_Button_Click(object sender, RoutedEventArgs e)
{
var LocalSettings = ApplicationData.Current.LocalSettings;
LocalSettings.Values.Add("paramter",
Input_TextBox.Text);
}
}
}