I want to change the foreground color of a TextBox in WPF. Here is the code:
foreach (Match m in RedWord)
{
TextBox1.SelectionStart = m.Index;
TextBox1.SelectionLength = m.Length;
TextBox1.Select(m.Index, m.Length);
TextBox1.SelectionBrush = Brushes.Red;
//EditorTextBox.Foreground = Brushes.Red;
}
The .SelectionBrush
does not appear to apply the foreground text color as I need it. How can I change my text foreground color on selection?