MainWindow.xaml.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using System.Text;
  2. using System.Windows;
  3. using System.Windows.Controls;
  4. using System.Windows.Data;
  5. using System.Windows.Documents;
  6. using System.Windows.Input;
  7. using System.Windows.Media;
  8. using System.Windows.Media.Imaging;
  9. using System.Windows.Navigation;
  10. using System.Windows.Shapes;
  11. namespace t8_elements
  12. {
  13. /// <summary>
  14. /// Interaction logic for MainWindow.xaml
  15. /// </summary>
  16. public partial class MainWindow : Window
  17. {
  18. public MainWindow()
  19. {
  20. InitializeComponent();
  21. }
  22. private void acceptButton_Click(object sender, RoutedEventArgs e)
  23. {
  24. MessageBox.Show("действие выполнено");
  25. }
  26. private void escButton_Click(object sende, RoutedEventArgs e)
  27. {
  28. this.Close();
  29. }
  30. private void checkBox_Unchecked(object sender, RoutedEventArgs e)
  31. {
  32. MessageBox.Show(checkBox.Content.ToString() + " не отмечен");
  33. }
  34. private void checkBox_Checked(object sender, RoutedEventArgs e)
  35. {
  36. MessageBox.Show(checkBox.Content.ToString() + " отмечен");
  37. }
  38. private void checkBox_Indeterminate(object sender, RoutedEventArgs e)
  39. {
  40. MessageBox.Show(checkBox.Content.ToString() + " в неопределенном состоянии");
  41. }
  42. private void RadioButton_Checked(object sender, RoutedEventArgs e)
  43. {
  44. RadioButton pressed = (RadioButton)sender;
  45. MessageBox.Show(pressed.Content.ToString());
  46. }
  47. private void Button_Click(object sender, RoutedEventArgs e)
  48. {
  49. textBox1.SelectionStart = 5;
  50. textBox1.SelectionLength = 10;
  51. textBox1.Focus();
  52. // данное выражение эквивалентно
  53. //textBox1.Select(5, 10);
  54. }
  55. private void list_Selected(object sender, SelectionChangedEventArgs e)
  56. {
  57. Phone p = (Phone)list.SelectedItem;
  58. MessageBox.Show(p.Title);
  59. }
  60. }
  61. }