Example #1
0
 public NoSource()
 {
     InitializeComponent();
     stu = new StudentWithNotify()
     {
         ID = 0, Name = "Tom", Skill = "eat"
     };
     this.DataContext = stu;
 }
Example #2
0
        public NotifyClrObject()
        {
            InitializeComponent();
            stu = new StudentWithNotify()
            {
                ID = 0, Name = "Tom", Skill = "eat"
            };
            Binding bdName = new Binding()
            {
                Source = stu, Path = new PropertyPath("Name")
            };
            Binding bdID = new Binding("ID")
            {
                Source = stu
            };
            Binding bdSkill = new Binding("Skill")
            {
                Source = stu
            };

            this.tbName.SetBinding(TextBox.TextProperty, bdName);
            this.tbID.SetBinding(TextBox.TextProperty, bdID);
            this.tbSkill.SetBinding(TextBox.TextProperty, bdSkill);
        }