摘要: 在笔记(一)中记了点Binding的Path相关, 因为Binding的带参构造器就只有Path的参数.所以Path是很重要的, 有了Path, 即使在没有指定Source的时候, Binding也会随着UI元素树一层一层往外找DataContext对象, 判断是否具有相应的Path, 有就拿来用.一, DataContext属性与Binding笔记(一)中的Binding, 除了控件间的Binding, 其他都是在C#代码处完成的.如何在XAML中Binding那些在C#中定义的实例呢?方法之一就是使用DataContext. 1, 准备一个类public class Student{ .. 阅读全文
posted @ 2012-10-25 14:52 陈惊蛰 阅读(3760) 评论(0) 推荐(1) 编辑
摘要: 上次学了点点Binding的皮毛, 然后就做别的事去了, 等回头再来看WPF的时候, 哈忘记了~于是写个例子补一下, 在继续学习Binding.1, 首先准备好一个类public class Hero{ public Hero(int id, string name, string skill, bool hasM) { this.Name = name; this.Id = id; this.Skill = skill; this.HasM = hasM; } public int Id { get; set; } public string Name { ... 阅读全文
posted @ 2012-10-25 11:19 陈惊蛰 阅读(2868) 评论(0) 推荐(0) 编辑