Good day everyone. I'm writing my first device-specific application which is a Windows Phone 7 panorama app. I'm currently still busy on the UI as I'm playing around with the features then I stumbled upon a problem that I couldn't fix. You see, I have two checkboxes for some sort of login form. One is a "Remember me" and the other a "Sign me in automatically" checkbox. The action I want is that when I uncheck Remember Me, I would like the Sign in Automatically checkbox to be unchecked and disabled. That I was able to do but the reverse always causes an error. I used to write simple PHP web apps and Javascript so I have some programming knowledge but C# is fairly new to me.
private void RememberMe_Unchecked(object sender, RoutedEventArgs e)
{
AutoSignIn.IsChecked = false;
AutoSignIn.IsEnabled = false;
}
That one works but this one doesn't:
private void RememberMe_Checked(object sender, RoutedEventArgs e)
{
AutoSignIn.IsEnabled = true;
}
The latter throws a "NullReferenceException was unhandled" error.
My XAML code looks like this:
<CheckBox Content="Remember me" Height="71" Name="RememberMe" Unchecked="RememberMe_Unchecked" Checked="RememberMe_Checked" IsEnabled="True" IsChecked="True" />
<CheckBox Content="Sign me in automatically" Height="71" Name="AutoSignIn" IsEnabled="True" IsChecked="True" />
I've done some research and my approach seem to be wrong but I'm not sure how to make it work. I would highly appreciate any helpful advise. Thanks!