diff --git a/FluentWeather/Views/MainPage.xaml.cs b/FluentWeather/Views/MainPage.xaml.cs index 5dc7ae4c..2d07e3d1 100644 --- a/FluentWeather/Views/MainPage.xaml.cs +++ b/FluentWeather/Views/MainPage.xaml.cs @@ -633,6 +633,9 @@ private async void UnitsSegmented_OnSelectionChanged(object sender, SelectionCha { var segmented = (Segmented) sender; + if (!segmented.IsLoaded) + return; + //save selected index to local settings await ApplicationData.Current.LocalSettings.SaveAsync("selectedUnits", segmented.SelectedIndex); @@ -672,6 +675,9 @@ private async void TimeFormatSegmented_OnSelectionChanged(object sender, Selecti { var segmented = (Segmented) sender; + if (!segmented.IsLoaded) + return; + //save selected index to local settings await ApplicationData.Current.LocalSettings.SaveAsync("is12HourFormat", segmented.SelectedIndex == 1);