Hi guys!
I'm hoping I can find some help here with saving user settings for checkboxes and radiobuttons. I can't seem to find anything on it on the internet but when I do it doesn't work. Any help will be appreciated!
:)
Squabbi
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
FroglegPosted Oct 6, 2013, 3:39 PM
code:
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
loadStuff();
}
public void loadStuff()
{
if (Properties.Settings.Default.ck1)
{
checkBox1.IsChecked = true;
}
else if (!Properties.Settings.Default.ck1)
{
checkBox1.IsChecked = false;
}
}
private void CheckBox_Checked(object sender, RoutedEventArgs e)
{
Properties.Settings.Default.ck1 = true;
Properties.Settings.Default.Save();
}
private void CheckBox_Unchecked(object sender, RoutedEventArgs e)
{
Properties.Settings.Default.ck1 = false;
Properties.Settings.Default.Save();
}
}