コード例 #1
0
 public MainWindow()
 {
     InitializeComponent();
     //this.gridRoot.AddHandler(Button.ClickEvent, new RoutedEventHandler(this.buttonRight_Click));
     this.AddHandler(Student.NameChangedEvent, new RoutedEventHandler(this.StudentNameChangedhandler));
     Student2.AddNameChangeHandler(this, new RoutedEventHandler(this.StudentNameChangedhandler2));
 }
コード例 #2
0
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            Student2 stu = new Student2()
            {
                id = 101, Name = "Tim"
            };

            stu.Name = "Tom";
            RoutedEventArgs arg = new RoutedEventArgs(Student2.NameChangedEvent, stu);

            button2.RaiseEvent(arg);
        }