摘要:
10. 数据提供程序(1) XmlDataProviderXmlDataProvider 允许我们直接将 XML 数据作为数据源,我们将前面章节的例子改成 XML 数据岛试试,注意此时我们已经不需要在代码中定义 Personal、PersonalList 类型。 1 <Window x:Class="Learn.WPF.Window1" 2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 3 xmlns:x="http://schemas.microsof 阅读全文
posted @ 2011-08-22 16:51
徐文峰
阅读(280)
评论(0)
推荐(0)
摘要:
8. 集合视图当绑定到一个集合对象时,WPF 总是默认提供一个视图 (CollectionViewSource)。视图会关联到源集合上,并自动将相关的操作在目标对象上显示出来。(1) 排序向 CollectionViewSource.SortDescriptions 属性中插入一个或多个排序条件 (SortDescription) 即可实现单个或多个条件排序。Window1.xaml 1 <Window x:Class="Learn.WPF.Window1" 2 xmlns="http://schemas.microsoft.com/winfx/2006/x 阅读全文
posted @ 2011-08-22 16:47
徐文峰
阅读(426)
评论(0)
推荐(0)
摘要:
6. 数据模板数据模板为展示数据提供了极大的灵活性,我们继续以前面的例子来看看它的能力。 1 <Window x:Class="Learn.WPF.Window1" 2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 4 xmlns:my="clr-namespace:Learn.WPF" 5 Title=&quo 阅读全文
posted @ 2011-08-22 16:33
徐文峰
阅读(331)
评论(0)
推荐(0)
摘要:
4. 绑定到集合在实际开发中,我们通常是将一个集合数据对象 (比如数据表) 绑定到一个 DataGrid 或者 ListBox 列表控件上,这时候我们就需要使用到集合绑定方式。WPF 特意为我们实现了一个 System.Collections.ObjectModel.ObservableCollection<T> 泛型集合,省却了我们写具备变更通知功能集合代码的时间。Window1.xaml<Window x:Class="Learn.WPF.Window1" xmlns="http://schemas.microsoft.com/winfx/2 阅读全文
posted @ 2011-08-22 16:26
徐文峰
阅读(346)
评论(0)
推荐(0)

浙公网安备 33010602011771号