So I have a combobox:
<ComboBox IsEditable="True" TextBoxBase.TextChanged="textBox_Changed"/>
When the text in the combobox changes, it fires off the textBox_changed function:
private void textBox_Changed(object sender, RoutedEventArgs e)
{
LinearGradientBrush gradient = new LinearGradientBrush(Colors.MistyRose, Colors.SandyBrown, new Point(0, 0), new Point(0, 1));
this.saveButton.Background = gradient;
}
What this function does is change the background color of a button elsewhere on the window. So far this works perfectly. The issue appears when I try to use this same function with a TextBox instead of a Combobox:
<TextBox TextChanged="textBox_Changed"/>
When I run the application, I get the following error:
Object reference not set to an instance of an object.
Very bizarre error that I can't figure out.