As promised, the overkill version, which doesn't makes sense for your question but might help you out in another way: a simple viewmodel with INotifyPropertyChanged.
I wil extend the example with some binding.
Your viewmodel:
public class SettingsViewModel : INotifyPropertyChanged
{
private bool _autoUpdate;
public SettingsViewModel()
{
//set initial value
_autoUpdate = Properties.Settings.Default.autoCheckForUpdates;
}
public bool AutoCheckForUpdates
{
get { return _autoUpdate; }
set
{
if (value == _autoUpdate) return;
_autoUpdate= value;
Properties.Settings.Default.autoCheckForUpdates = value;
Properties.Settings.Default.Save();
OnPropertyChanged();
}
}
//the INotifyPropertyChanged stuff
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
In the code behind of your XAML:
public SettingsWindow()
{
InitializeComponent();
this.DataContext = new SettingsViewModel();
}
Now, in your XAML, you can bind to this property, through a textbox for example:
<CheckBox IsChecked="{Binding AutoCheckForUpdates}"/>