tags:

views:

19

answers:

1

Hello,

My application shows a question and possible answers on that question. Now I want to give the correct answer (specified in the "CorrectAnswer" property) a green color. Can someone help me? Thanks.

public class Exercise
{
    public string QuestionText { get; set; }
    public int CorrectAnswer { get; set; }
    public Answer[] Answers { get; set; }
    ...
}

public class Answer
{
    public string AnswerText { get; set; }
    ...
}

XAML:

    <StackPanel Orientation="Vertical">
        <Label Content="{Binding Path=QuestionText}"></Label>
        <ItemsControl ItemsSource="{Binding Path=Answers}">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Label Content="{Binding Path=AnswerText}"></Label>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </StackPanel>
A: 

If you have some idea on ValueConverter in WPF, better make use of that. That will give you a lot of flexibility and easy to implement. Please let me know, if you still have some doubt.

Siva Gopal
Ok, thanks. I have a solution. I've used the MultiValueConverter.
Gazza
Thats cool. :-)
Siva Gopal