Am I having trouble saving my application settings? I am creating a universal application for Windows 10, and I have a slider whose value I want to keep.
I use this code to save it:
private void musicVolume_ValueChanged(object sender, RangeBaseValueChangedEventArgs e)
{
ApplicationDataContainer AppSettings = ApplicationData.Current.LocalSettings;
AppSettings.Values["musicV"] = musicVolume.Value;
}
And in the constuctor of the page, I have the following lines of code:
ApplicationDataContainer AppSettings = ApplicationData.Current.LocalSettings;
if (AppSettings.Values.ContainsKey("musicV"))
{
musicVolume.Value = Convert.ToDouble(AppSettings.Values["musicV"]);
}
It should show a new value when I go to this page, but it’s not, it always shows the last one by default. Why does it not work and how to make it work?
PS: sorry for my bad english ...
source
share