Reputation: 15
I have an unknown problem with building my first UWP App.
On button onclick method I want to check if one of checkboxes is checked and if yes I want to open a new frame:
namespace IDG
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
private void bt_start_Click(object sender, RoutedEventArgs e)
{
if (rb_quiz.Checked)
{
this.Frame.Navigate(typeof(Page2));
}
}
}
}
Visual Studio marks error on that line:
if (rb_quiz.Checked)
The popup says:
The Event '
ToggleButton.Checked
' can only appear on the left hand side of += or -"
I have checked "==Checked
" or "isChecked
". But nothing works. My radiobutton
is called rb_quiz
.
Upvotes: 1
Views: 1699
Reputation: 11841
According to the documentation, Checked
is an event that "Fires when a ToggleButton is checked". You instead want to use the property IsChecked
Upvotes: 0
Reputation: 13394
Checked
is an Event, you are looking for IsChecked
which is a Nullable<Boolean>
.
Try this:
if (rb_quiz.IsChecked == true)
Upvotes: 1