namespace Station
{
[ValueConversion(typeof(string), typeof(SolidColorBrush))]
public class ColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
string state = (string)value;
if ( state.Length > 0 )
return new SolidColorBrush(Colors.Green);
else
return new SolidColorBrush(Colors.Red);
Hello, Do you mean like this.
The txtGebindeSlot1 control should bind the BackGround to a property (SolidColor) and when you set that property in code then the UI will use the value.
Can you make a sample for me? Thanks.
The code works not.
See here