So I'm trying to accomplish something like this:
For example the standard news app in windows 10 I can select an item:
So when I restart the app the selection will still be the same:
So I want to accomplish the same thing and even save the selected item as a string. So I probably need 2 localsettings one for the selecteditem and one for saving the content of the selected item as string.
This is what I came up with but this doesn't work (XAML):
<ComboBox Name="Preference" SelectionChanged="ComboBox_SelectionChanged">
<ComboBoxItem Content="Diving"/>
<ComboBoxItem Content="Snorkeling"/>
<ComboBoxItem Content="Diving and Snorkeling"/>
</ComboBox>
(cs)
public Settings()
{
this.InitializeComponent();
Preference.SelectedItem = App.localSettings.Values["Preference"];
}
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
App.localSettings.Values["Preference"] = Preference.SelectedItem;
}
I'm still trying to learn C# so please keep it simple. I tried searching it but didn't really find something to answer my questions.