Introduction This is an article on WPF Binding Cheat Sheet. Some of the Binding won't work for Silverlight 3. Basic Binding {Binding} Bind to current DataContext. {Binding Name} Bind to the "Name" proeprty of the current DataContext. {Bindind Na
Binding作为数据的桥梁,连通业务逻辑层的对象(源对象)和UI的控件对象(目标对象).在这座桥梁上,我们不仅可以控制在源对象与目标对象是双向通行还是单向通行.还可以控制数据的放行时机,甚至可以在这座桥上搭建一些关卡用来转换数据类型或者检验数据的正确性 我们先做一个最基本的例子, 创建一个"Student"类,这个类的实例将作为数据源来使用 public class Student { private int _id; public int ID { get { return _id
WPF中Converter的用于对数据的转换.以下实例将实现将数据中的性别属性的转换(0:男,1:女). 1.创建SexConverter.cs类,并实现IValueConverter接口 public class SexConverter : IValueConverter{ public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo cultur
转自:http://blog.csdn.net/lisenyang/article/details/18312199 1.集合作为数据源 首先我们先创建一个模型类 public class Student { public int ID { get; set; } public String Name { get; set; } } 然后我们创建我们的页面布局 <StackPanel Width=" HorizontalAlignment="Left"> <