Guest User

Untitled

a guest
Jun 18th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. if(tbSearch.Text == europe.England.Content.ToString())
  2. {
  3. europe.Show();
  4. europe.England.IsChecked = true;
  5. }
  6. else if(tbSearch.Text == europe.Island.Content.ToString())
  7. {
  8. europe.Show();
  9. europe.Island.IsChecked = true;
  10. }
  11. else if(tbSearch.Text == europe.Nederland.Content.ToString())
  12. {
  13. europe.Show();
  14. europe.Nederland.IsChecked = true;
  15. }
  16. else if(tbSearch.Text == europe.Germany.Content.ToString())
  17. {
  18. europe.Show();
  19. europe.Germany.IsChecked = true;
  20. }
  21.  
  22. var searchText = tbSearch.Text;
  23.  
  24. var radioButton = europe.Items.Cast<ListBoxItem>().Select(item => item.Content as RadioButton).FirstOrDefault(item => item?.Content.ToString() == searchText);
  25. if (radioButton != null)
  26. {
  27. europe.Show(); // откуда у ListBox'a метод .Show()?
  28. radioButton.IsChecked = true;
  29. }
Add Comment
Please, Sign In to add comment