Okay, I have a bit of a weird bug…
This works fine:
private void radioButtonNormalPoint_Checked(object sender, RoutedEventArgs e)
{
//comboBoxNormalPoint.SelectedIndex = 0;
//ellipsePoint.Fill = System.Windows.Media.Brushes.Black;
}
This throws System.Reflection.TargetInvocationException:
private void radioButtonNormalPoint_Checked(object sender, RoutedEventArgs e)
{
comboBoxNormalPoint.SelectedIndex = 0;
ellipsePoint.Fill = System.Windows.Media.Brushes.Black;
}
Also, it doesn’t let me debug it; it crashes as the program loads. If I put a breakpoint anywhere it doesn’t hit it; it just errors right away.
The event is probably raised before the elements are fully loaded or the references are still unset, hence the exceptions. Try only setting properties if the reference is not
nullandIsLoadedistrue.