I cannot bind a foreground color to a property ...
I have it:
<TextBox Grid.Column="1" Grid.Row="1" Width="150" Margin="10,5"
IsReadOnly="True" Name="Output" FontSize="20" Foreground="{Binding Path=ForegroundColor}"/>
and
private Brush foregroundColor;
public Brush ForegroundColor {
get { return foregroundColor; }
set {
foregroundColor = value;
OnPropertyChanged("ForegroundColor");
}
}
private void CheckBtn_Click(object sender, RoutedEventArgs e) {
if (IsPalindrome(Input.Text)) {
ForegroundColor = Brushes.Gold;
Output.Text = "Yep";
} else
Output.Text = "Nope";
}
I'm just a beginner, so this is a simple project;) Some sources are welcome to study ... sorry for the mistakes, I'm from Ukraine
source
share