Q:

Change textbox colour upon correct letter?

I am creating a crossword using WPF. All my text boxes are red, but I want them to change to green when a certain textbox contains the correct word.
Could anybody help, please?

A:

Bind your TextBox's Background to a string property, let's name it Word
Then use a ValueConverter to convert the Word to a Color, let's name it WordColorConverter (which is a class implementing IValueConverter)
Your xaml would look like this assuming it's in a Window and you place the WordColorConverter in the your local namespace
<Window.Resources>
    <local:WordColorConverter x:Key="WordColorConverter"/>
</Window.Resources>

<Grid>
    <TextBox Text="{Binding Word}",
               Background="{Binding Word, Converter={StaticResource WordColorConverter}}"/><</
</Grid>

And your WordColorConverter class would look something like this...
class WordColorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string word = (string)value;
            if (word.Equals("correct word"))
            {
                return new SolidColorBrush(Colors.Green);
            }
            else
            {
                return new SolidColorBrush(Colors.Red);
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }

EDIT: you could try this for MultiBinding
<TextBox Text="{Binding InputWord, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}">
    <TextBox.Background>
        <MultiBinding Converter="{StaticResource WordColorConverter}">
            <Binding Path="InputWord" />
            <Binding Path="CorrectWord" />
        </MultiBinding>
    </TextBox.Background>
</TextBox>

 
   public class WordColorConverter : IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            string inputWord = (string)values[0];
            string correctWord = (string)values[1];
            if (inputWord.Equals(correctWord))
            {
                return new SolidColorBrush(Colors.Green);
            }
            else
            {
                return new SolidColorBrush(Colors.Red);
            }
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {

            throw new NotImplementedException();
        }
    }

