Guest User

Untitled

a guest
Apr 19th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. <ListBox x:Name="ListBoxQuestionAnswers" ItemsSource="{x:Bind Question.Answers}" SelectionMode="Single" SelectionChanged="ListBoxQuestionAnswers_OnSelectionChanged">
  2. <ListBox.ItemTemplate>
  3. <DataTemplate>
  4. <TextBlock x:Name="TextBlockInListBox" TextWrapping="Wrap" Text="{Binding}"/>
  5. </DataTemplate>
  6. </ListBox.ItemTemplate>
  7. </ListBox>
  8.  
  9. private void ListBoxQuestionAnswers_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
  10. {
  11. if (ListBoxQuestionAnswers.SelectedIndex == Question.CorrectAnswerIndex)
  12. {
  13. Application.Current.Resources["SystemControlHighlightListAccentLowBrush"] = new SolidColorBrush(Colors.Green);
  14. Application.Current.Resources["SystemControlHighlightListAccentMediumBrush"] = new SolidColorBrush(Colors.Green);
  15. }
  16. else
  17. {
  18. Application.Current.Resources["SystemControlHighlightListAccentLowBrush"] = new SolidColorBrush(Colors.Red);
  19. Application.Current.Resources["SystemControlHighlightListAccentMediumBrush"] = new SolidColorBrush(Colors.Red);
  20. }
  21.  
  22. }
Add Comment
Please, Sign In to add comment