public class ErrorListToForegroundConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, string language) { var errorCount = (int)value; return errorCount != 0 ? new SolidColorBrush(Colors.Yellow) : null; } public object ConvertBack(object value, Type targetType, object parameter, string language) { throw new NotImplementedException(); } }
public class ErrorListToForegroundConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, string language) { var errorCount = (int)value; return errorCount != 0 ? new SolidColorBrush(Colors.Yellow) : null; } public object ConvertBack(object value, Type targetType, object parameter, string language) { throw new NotImplementedException(); } }
My textbox is not turn back to default foreground when being input or focus When lose focus and refocus again I apply the default foreground I think the problem is in here
return errorCount != 0 ? new SolidColorBrush(Colors.Yellow) : null
return errorCount != 0 ? new SolidColorBrush(Colors.Yellow) : null
when change the
null
null
to new
SolidColorBrush(Colors.Green)
SolidColorBrush(Colors.Green)
It react and turn green even when being focus does anyone know how to set the textbox foreground back to default color using C# ?