Пример #1
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            Student0 stu = new Student0();

            stu.SetValue(Student0.NameProperty, textBox1.Text);

            textBox2.SetValue(TextBox.TextProperty, stu.GetValue(Student0.NameProperty));
            stu.Name      = textBox1.Text;
            textBox2.Text = stu.Name;
        }
Пример #2
0
        public Window19()
        {
            InitializeComponent();
            stu = new Student0();
            Binding bind = new Binding("Text")
            {
                Source = textBox1
            };

            stu.SetBinding(Student0.NameProperty, bind);

            textBox2.SetBinding(TextBox.TextProperty, new Binding("Name")
            {
                Source = stu
            });
        }