I'm getting a error Object reference not set to an instance of an object
. I think i'm not initialize something.
This is the code; the error is on line if (btn.Background.Equals(new SolidColorBrush(Color.FromArgb(0, 0, 0, 0))))
:
private void vbOpenGuiaMaestro_Tapped(object sender, TappedRoutedEventArgs e)
{
Button btn = default(Button);
if (btn.Background.Equals(new SolidColorBrush(Color.FromArgb(0, 0, 0, 0))))
{
btn.Background = materiaColor;
btn.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255));
stckTeachersGuideClosed.Visibility = Visibility.Visible;
stckTeachersGuideOpened.Visibility = Visibility.Collapsed;
}
else
{
btn.Background = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
btn.Foreground = new SolidColorBrush(Color.FromArgb(255, 140, 140, 140));
}
}