<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>WPF</title>
        <link>http://blog.entlib.com/EntLib/category/46.aspx</link>
        <description>Windows Presentation Foundation</description>
        <language>zh-CN</language>
        <copyright>EntLib.com</copyright>
        <managingEditor>entlib@hotmail.com</managingEditor>
        <generator>EntLib.com Blog Version 3.0.0.0</generator>
        <item>
            <title>WPF 范例程序之二 – 构建Hello Kitty 专卖店产品演示 – 附源代码下载</title>
            <link>http://blog.entlib.com/EntLib/archive/2009/01/29/wpf-hello-kitty.aspx</link>
            <description>&lt;div align="center"&gt;&lt;b&gt;WPF &lt;/b&gt;&lt;b&gt;范例程序之二 – &lt;/b&gt;&lt;b&gt;构建Hello Kitty &lt;/b&gt;&lt;b&gt;专卖店产品演示 – &lt;/b&gt;&lt;b&gt;附源代码下载&lt;/b&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;本文演示如何应用WPF 的数据绑定技术、WPF动画、ObservableCollection集合类，构建一个可爱的Hello Kitty 专卖店产品演示应用程序。在此，感谢&lt;a href="http://www.giftcenter.cn/"&gt;http://www.giftcenter.cn&lt;/a&gt; (礼品中心网) 提供的Hello Kitty 产品图片。&lt;br /&gt;
&lt;br /&gt;
WPF 系列学习笔记上一篇文章：&lt;br /&gt;
&lt;a id="AggRecentPosts1_RecentPosts_ctl00_Hyperlink2" href="http://blog.entlib.com/EntLib/archive/2009/01/27/wpf-data-binding.aspx"&gt;&lt;font color="#41519a"&gt;WPF 范例程序之一 – 数据绑定(Data Binding) – 附源代码下载&lt;/font&gt;&lt;/a&gt;&lt;br /&gt;
 &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;范例程序演示界面如下：&lt;br /&gt;
 &lt;/div&gt;
&lt;div style="text-align: center"&gt;&lt;img height="528" alt="" width="663" src="/userfiles/EntLib/image/WPF/WPF_2_1.gif" /&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;下面对范例程序中使用的一些技术，进行逐一介绍。本文由&lt;a href="http://blog.entlib.com/"&gt;http://blog.entlib.com&lt;/a&gt; 开源博客平台小组提供，欢迎交流、分享.NET 开源技术。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;b&gt;1. App.xaml &lt;/b&gt;&lt;b&gt;文件中Application.Resources &lt;/b&gt;&lt;b&gt;节设置应用程序范围资源，如样式、画笔、数据源等等。&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;范例程序中定义了ObjectDataProvider，将返回PhotoList 集合对象。&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;    &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;Application.Resources&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;        &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;ObjectDataProvider&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; x&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;:&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt;Name&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;="PhotosODP"&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; x&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;:&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt;Key&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;="Photos"&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; ObjectType&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;="{&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;x&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;:&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;Type&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; sbts&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;:&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt;PhotoList&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;}" /&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;    &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;Application.Resources&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;同时，在App.xaml.cs 代码文件中，对上述集合对象进行了初始化操作。&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;        &lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; Application_Startup(&lt;span style="color: blue"&gt;object&lt;/span&gt; sender, &lt;span style="color: #2b91af"&gt;StartupEventArgs&lt;/span&gt; e)&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;        {&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;            &lt;span style="color: #2b91af"&gt;Window1&lt;/span&gt; theWindow = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Window1&lt;/span&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;            theWindow.Show();&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt; &lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;            &lt;span style="color: #2b91af"&gt;ObjectDataProvider&lt;/span&gt; dataProvider = &lt;span style="color: blue"&gt;this&lt;/span&gt;.Resources[&lt;span style="color: #a31515"&gt;"Photos"&lt;/span&gt;] &lt;span style="color: blue"&gt;as&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ObjectDataProvider&lt;/span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;            &lt;span style="color: #2b91af"&gt;PhotoList&lt;/span&gt; photoList = dataProvider.Data &lt;span style="color: blue"&gt;as&lt;/span&gt; &lt;span style="color: #2b91af"&gt;PhotoList&lt;/span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;            theWindow.Photos = photoList;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;            theWindow.Photos.Path = &lt;span style="color: #a31515"&gt;@"..\..\HelloKitty"&lt;/span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 9pt"&gt;        }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;项目文件夹 HelloKitty 中存放着Hello Kitty 系列产品图片（来自&lt;a href="http://www.giftcenter.cn/"&gt;http://www.giftcenter.cn&lt;/a&gt; 礼品中心网）。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;b&gt;2. &lt;/b&gt;&lt;b&gt;数据绑定&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;WPF支持任何类型的.NET对象作为数据源绑定到WPF对象。对于所有的ItemsControl对象都有一个ItemsSource依赖属性，这是专门为数据绑定而准备的。ItemsSource的类型是IEnumerable，所以对于我们几乎所有的集合类型我们都可以轻易的改变成ItemsSource的源对象。&lt;/div&gt;
&lt;div&gt;将上述定义的Application.Resources 应用到ListBox 上，实现Hello Kitty 产品图片的展示。&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;            &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;ListBox&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; Style&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;="{&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;DynamicResource&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; PhotoListStyle&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;}"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;               &lt;span style="color: red"&gt; Grid.Row&lt;/span&gt;&lt;span style="color: blue"&gt;="1"&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;               &lt;span style="color: red"&gt; Grid.ColumnSpan&lt;/span&gt;&lt;span style="color: blue"&gt;="3"&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;               &lt;span style="color: red"&gt; Name&lt;/span&gt;&lt;span style="color: blue"&gt; ="PhotoListBox"&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;               &lt;span style="color: red"&gt; Margin&lt;/span&gt;&lt;span style="color: blue"&gt;="0,0,0,20"&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;b&gt;&lt;span style="font-size: 9pt"&gt;               &lt;span style="color: red"&gt; DataContext&lt;/span&gt;&lt;span style="color: blue"&gt;="{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding&lt;/span&gt;&lt;span style="color: red"&gt; Source&lt;/span&gt;&lt;span style="color: blue"&gt;={&lt;/span&gt;&lt;span style="color: #a31515"&gt;StaticResource&lt;/span&gt;&lt;span style="color: red"&gt; Photos&lt;/span&gt;&lt;span style="color: blue"&gt;}}"&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;               &lt;span style="color: red"&gt; SelectionChanged&lt;/span&gt;&lt;span style="color: blue"&gt; ="PhotoListSelection"&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;b&gt;&lt;span style="font-size: 9pt"&gt;               &lt;span style="color: red"&gt; ItemsSource&lt;/span&gt;&lt;span style="color: blue"&gt;="{&lt;/span&gt;&lt;span style="color: #a31515"&gt;Binding&lt;/span&gt;&lt;span style="color: blue"&gt; }"&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;               &lt;span style="color: red"&gt; ItemContainerStyle&lt;/span&gt;&lt;span style="color: blue"&gt;="{&lt;/span&gt;&lt;span style="color: #a31515"&gt;DynamicResource&lt;/span&gt;&lt;span style="color: red"&gt; PhotoListItem&lt;/span&gt;&lt;span style="color: blue"&gt;}"&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 9pt"&gt;               &lt;span style="color: red"&gt; SelectedIndex&lt;/span&gt;&lt;span style="color: blue"&gt;="0" /&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;DataContext就是数据上下文对象，它是为了避免多个对象共享一个数据源时重复的对所有对象显式地用binding标记，而把同一个数据源在上下文对象的某个范围内共享，这样当一个绑定没有显式的源对象时，WPF会遍历找到一个非空的DataContext为止。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;b&gt;3. ListBox&lt;/b&gt;&lt;b&gt;控件的SelectionChanged &lt;/b&gt;&lt;b&gt;事件。&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;PhotoListSelection 方法负责读取ListBox 控件当前选择的Item图片，并进一步根据选择的产品图片，创建BitmapFrame 对象，最后绑定到CurrentPhoto1（Image控件）上，显示并放大选择的产品图片。&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;        &lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; PhotoListSelection(&lt;span style="color: blue"&gt;object&lt;/span&gt; sender, &lt;span style="color: #2b91af"&gt;SelectionChangedEventArgs&lt;/span&gt; e)&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;        {&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;            &lt;span style="color: #2b91af"&gt;String&lt;/span&gt; path = ((sender &lt;span style="color: blue"&gt;as&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ListBox&lt;/span&gt;).SelectedItem.ToString());&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;            &lt;span style="color: #2b91af"&gt;BitmapSource&lt;/span&gt; img = &lt;span style="color: #2b91af"&gt;BitmapFrame&lt;/span&gt;.Create(&lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Uri&lt;/span&gt;(path));&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;            CurrentPhoto1.Source = img;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 9pt"&gt;        }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;b&gt;4. ObservableCollection(T) &lt;/b&gt;&lt;b&gt;类&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;WPF提供了一个ObservableCollection类，它实现了一个暴露了INotifyPropertyChanged的数据集合。也就是说我们不需要自己对每个单独的数据实现INotifyPropertyChanged结构。Observablecollection表示一个动态数据集合，在添加项、移除项或刷新整个列表时，此集合将提供通知。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;在本范例程序中，PhotoList 集合类继承ObservableCollection&amp;lt;ImageFile&amp;gt;，代码如下：&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 9pt; color: blue"&gt;public&lt;/span&gt;&lt;span style="font-size: 9pt"&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;PhotoList &lt;font color="#000000"&gt;: &lt;/font&gt;&lt;span style="color: #2b91af"&gt;ObservableCollection&lt;/span&gt;&lt;font color="#000000"&gt;&amp;lt;&lt;/font&gt;&lt;span style="color: #2b91af"&gt;ImageFile&lt;/span&gt;&lt;font color="#000000"&gt;&amp;gt;&lt;/font&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt; &lt;/div&gt;
&lt;div&gt;在绑定PhotoList类到ListBox之后，只要PhotoList 对象发生了变化，Listbox 的数据也会有相应的变化，也就是是PhotoList集合中的插入或移除操作可以自动更新 UI。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;如果你有兴趣，你可以将上述代码调整为List 集合，如下所示：&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 9pt; color: blue"&gt;public&lt;/span&gt;&lt;span style="font-size: 9pt"&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;PhotoList&lt;/span&gt; : &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;ImageFile&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;再次运行应用程序，你会发现ListBox 无法正确显示Hello Kitty 产品图片列表了。但是如果你进一步修改Application_Startup方法的代码，如下所示：&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;        &lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; Application_Startup(&lt;span style="color: blue"&gt;object&lt;/span&gt; sender, &lt;span style="color: #2b91af"&gt;StartupEventArgs&lt;/span&gt; e)&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;        {&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;            &lt;span style="color: #2b91af"&gt;Window1&lt;/span&gt; theWindow = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Window1&lt;/span&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt; &lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;            &lt;span style="color: #2b91af"&gt;ObjectDataProvider&lt;/span&gt; dataProvider = &lt;span style="color: blue"&gt;this&lt;/span&gt;.Resources[&lt;span style="color: #a31515"&gt;"Photos"&lt;/span&gt;] &lt;span style="color: blue"&gt;as&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ObjectDataProvider&lt;/span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;            &lt;span style="color: #2b91af"&gt;PhotoList&lt;/span&gt; photoList = dataProvider.Data &lt;span style="color: blue"&gt;as&lt;/span&gt; &lt;span style="color: #2b91af"&gt;PhotoList&lt;/span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;            theWindow.Photos = photoList;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;            theWindow.Photos.Path = &lt;span style="color: #a31515"&gt;@"..\..\HelloKitty"&lt;/span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt; &lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;            theWindow.Show();&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 9pt"&gt;        }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;将theWindow.Show() 方法移到后面，再次运行代码，你会发现Hello Kitty 产品图片列表又可以正常显示了，但还是建议采用ObservableCollection&amp;lt;T&amp;gt;集合类的。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;范例程序运行环境：Visual Studio 2008 SP1。如果你对XAML不熟悉，建议你参考如下XAML学习笔记系列：&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/24/xaml.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之一&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/24/xaml-again.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之二&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/25/xaml-grid.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之三&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt; – Grid &lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;控件的使用&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/25/xaml-stackpanelflowdocumentreader.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之四&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt; – StackPanel&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;和&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;FlowDocumentReader&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;控件的使用&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-canvasviewbox.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之五&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt; – Canvas&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;和&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;ViewBox&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;控件的使用&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-nesting.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之六&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt; – &lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;控件嵌套&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;Nesting&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-resourcestransformations.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之七&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt; – Resources&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;和&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;Transformations&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-yet-again.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之八&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt; –&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;动画：缓慢旋转的按钮&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-hello-kitty.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之九&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt; – Hello Kitty &lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;专卖店产品演示&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;&lt;img src="http://blog.entlib.com/EntLib/aggbug/128.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>EntLib.com</dc:creator>
            <guid>http://blog.entlib.com/EntLib/archive/2009/01/29/wpf-hello-kitty.aspx</guid>
            <pubDate>Thu, 29 Jan 2009 02:08:48 GMT</pubDate>
            <wfw:comment>http://blog.entlib.com/EntLib/comments/128.aspx</wfw:comment>
            <comments>http://blog.entlib.com/EntLib/archive/2009/01/29/wpf-hello-kitty.aspx#feedback</comments>
            <wfw:commentRss>http://blog.entlib.com/EntLib/comments/commentRss/128.aspx</wfw:commentRss>
            <enclosure url="http://blog.entlib.com/userfiles/EntLib/file/WPF_GiftCenterStore.zip" length="2900" type="application/octetstream" />
        </item>
        <item>
            <title>WPF 范例程序之一 – 数据绑定(Data Binding) – 附源代码下载</title>
            <link>http://blog.entlib.com/EntLib/archive/2009/01/27/wpf-data-binding.aspx</link>
            <description>&lt;div align="center"&gt;&lt;b&gt;WPF &lt;/b&gt;&lt;b&gt;范例程序之一 – &lt;/b&gt;&lt;b&gt;数据绑定(Data Binding) – &lt;/b&gt;&lt;b&gt;附源代码下载&lt;/b&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;本文演示如何采用常用的技术创建WPF 数据绑定应用程序，如ListBox显示产品列表，Image显示产品图片等等，并提供基于VS 2008 的范例程序下载。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;首先，看看范例程序的演示界面：&lt;/div&gt;
&lt;div style="text-align: center"&gt;&lt;img height="492" alt="" width="657" src="/userfiles/EntLib/image/WPF/WPF_HelloKitty_ShoppingCart.gif" /&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;b&gt;下面介绍范例程序的一些基本要点：&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;&lt;b&gt;1. &lt;/b&gt;&lt;b&gt;数据源Data Source&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;基于演示的需要，本范例程序的数据源定义在XAML文件的Resources元素内，实际应用程序则多数从数据库中读取。&lt;/div&gt;
&lt;div style="text-indent: 21pt" align="left"&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;Window.Resources&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;        &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;local&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;:&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;ShoppingCart&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; x&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;:&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt;Key&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;="Cart"&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;            &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;local&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;:&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;ShoppingCartItem&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; SKU&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;="460"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;           &lt;span style="color: red"&gt; Item&lt;/span&gt;&lt;span style="color: blue"&gt;="&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;多媒体键盘"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;           &lt;span style="color: red"&gt; Value&lt;/span&gt;&lt;span style="color: blue"&gt;="65.00"&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;           &lt;span style="color: red"&gt; ShortDescription&lt;/span&gt;&lt;span style="color: blue"&gt;="&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;全新正品 Hello Kitty 迷你多媒体键盘/USB键盘/超薄键盘"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;           &lt;span style="color: red"&gt; ProductImage&lt;/span&gt;&lt;span style="color: blue"&gt;="http://www.giftcenter.cn/giftcenterpictures/img640/04/103/04-103-005.jpg"/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;            &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;local&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;:&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;ShoppingCartItem&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; SKU&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;="461"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;           &lt;span style="color: red"&gt; Item&lt;/span&gt;&lt;span style="color: blue"&gt;="&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;不倒翁牙签筒"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;           &lt;span style="color: red"&gt; Value&lt;/span&gt;&lt;span style="color: blue"&gt;="8.00"&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;           &lt;span style="color: red"&gt; ShortDescription&lt;/span&gt;&lt;span style="color: blue"&gt;="Hello Kitty &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;奇趣蛋型不倒翁牙签筒/牙签罐/牙签盒"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;           &lt;span style="color: red"&gt; ProductImage&lt;/span&gt;&lt;span style="color: blue"&gt;="http://www.giftcenter.cn/giftcenterpictures/img640/02/303/02-303-028.jpg"/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;            &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;local&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;:&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;ShoppingCartItem&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; SKU&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;="388"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;           &lt;span style="color: red"&gt; Item&lt;/span&gt;&lt;span style="color: blue"&gt;="&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;保健磁化水杯"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;           &lt;span style="color: red"&gt; Value&lt;/span&gt;&lt;span style="color: blue"&gt;="29.00"&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;           &lt;span style="color: red"&gt; ShortDescription&lt;/span&gt;&lt;span style="color: blue"&gt;="Hello Kitty &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;新款保温保健磁化水杯（陶瓷内胆)"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;           &lt;span style="color: red"&gt; ProductImage&lt;/span&gt;&lt;span style="color: blue"&gt;="http://www.giftcenter.cn/giftcenterpictures/img640/02/310/02-310-020.jpg"/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;            &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;local&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;:&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;ShoppingCartItem&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; SKU&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;="242"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;           &lt;span style="color: red"&gt; Item&lt;/span&gt;&lt;span style="color: blue"&gt;="&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;眼镜盒"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;           &lt;span style="color: red"&gt; Value&lt;/span&gt;&lt;span style="color: blue"&gt;="15.00"&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;           &lt;span style="color: red"&gt; ShortDescription&lt;/span&gt;&lt;span style="color: blue"&gt;="Hello Kitty &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;白色皮质眼镜盒(3) 情侣小礼品"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;           &lt;span style="color: red"&gt; ProductImage&lt;/span&gt;&lt;span style="color: blue"&gt;="http://www.giftcenter.cn/giftcenterpictures/img640/02/204/02-204-005.jpg"/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;        &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;local&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;:&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;ShoppingCart&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;    &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;Window.Resources&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;b&gt;2. &lt;/b&gt;&lt;b&gt;数据绑定ListBox&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;在本范例程序中，我们绑定ListBox到动态的数据集合中List&amp;lt;ShoppingCartItem&amp;gt;。&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;        &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;ListBox&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; Grid.Row&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;="1"&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; Grid.ColumnSpan&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;="4"&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; ItemsSource&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;="{&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;Binding&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;}"&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; Grid.RowSpan&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;="1"&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; SelectionChanged&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;="ListBox_SelectionChanged"&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;            &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;                &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;                    &lt;/span&gt;&lt;span style="font-size: 9pt; color: green"&gt;&amp;lt;!-- the outer StackPanel (one per row) --&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;                    &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; Orientation&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;="Horizontal"&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; Width&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;="520"&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;                        &lt;/span&gt;&lt;span style="font-size: 9pt; color: green"&gt;&amp;lt;!-- the inner stack panels &lt;/span&gt;&lt;span style="font-size: 9pt; color: green"&gt;–&lt;/span&gt;&lt;span style="font-size: 9pt; color: green"&gt; one per column --&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;                        &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; Orientation&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;="Vertical"&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; Width&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;="40"&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;                            &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;TextBlock&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; Text&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;="{&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;Binding&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; Path&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;=SKU}" /&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;                        &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;                        &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; Orientation&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;="Vertical"&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; Width&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;="100"&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;                            &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;TextBlock&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; Text&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;="{&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;Binding&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; Path&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;=Item}" /&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;                        &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;                        &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; Orientation&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;="Vertical"&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; Width&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;="330"&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;                            &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;TextBlock&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; Text&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;="{&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;Binding&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; Path&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;=ShortDescription}" /&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;                        &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;                        &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; Orientation&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;="Vertical"&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; Width&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;="60"&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;                            &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;TextBlock&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; Text&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;="{&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;Binding&lt;/span&gt;&lt;span style="font-size: 9pt; color: red"&gt; Path&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;=Value}" /&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;                        &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;                    &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;StackPanel&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;                &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;DataTemplate&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;            &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;ListBox.ItemTemplate&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;        &lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515"&gt;ListBox&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;b&gt;3. ListBox&lt;/b&gt;&lt;b&gt;的SelectionChanged&lt;/b&gt;&lt;b&gt;事件&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;通过选择ListBox中显示的产品列表，触发ListBox的SelectionChanged事件，在对应的方法中，切换产品图片的显示。&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;        &lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; ListBox_SelectionChanged(&lt;span style="color: blue"&gt;object&lt;/span&gt; sender, &lt;span style="color: #2b91af"&gt;SelectionChangedEventArgs&lt;/span&gt; e)&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;        {&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;            &lt;span style="color: #2b91af"&gt;ListBox&lt;/span&gt; lb = sender &lt;span style="color: blue"&gt;as&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ListBox&lt;/span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;            &lt;span style="color: #2b91af"&gt;ShoppingCartItem&lt;/span&gt; scItem = lb.SelectedItem &lt;span style="color: blue"&gt;as&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ShoppingCartItem&lt;/span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;            &lt;span style="color: green"&gt;// Create Image Element&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;            &lt;span style="color: #2b91af"&gt;Image&lt;/span&gt; myImage = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Image&lt;/span&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;            myImage.Width = 500;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt; &lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;            &lt;span style="color: green"&gt;// Create source&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;            &lt;span style="color: #2b91af"&gt;BitmapImage&lt;/span&gt; myBitmapImage = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;BitmapImage&lt;/span&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt; &lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;            &lt;span style="color: green"&gt;// BitmapImage.UriSource must be in a BeginInit/EndInit block&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;            myBitmapImage.BeginInit();&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;            myBitmapImage.UriSource = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Uri&lt;/span&gt;(scItem.ProductImage);&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt; &lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;            myBitmapImage.DecodePixelWidth = 500;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;            myBitmapImage.EndInit();&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt; &lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 9pt"&gt;            ProductImage.Source = myBitmapImage;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 9pt"&gt;        }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;范例程序运行环境：Visual Studio 2008 SP1。如果你对XAML不熟悉，建议你参考如下XAML学习笔记系列：&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/24/xaml.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之一&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/24/xaml-again.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之二&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/25/xaml-grid.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之三&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt; – Grid &lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;控件的使用&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/25/xaml-stackpanelflowdocumentreader.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之四&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt; – StackPanel&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;和&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;FlowDocumentReader&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;控件的使用&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-canvasviewbox.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之五&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt; – Canvas&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;和&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;ViewBox&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;控件的使用&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-nesting.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之六&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt; – &lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;控件嵌套&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;Nesting&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-resourcestransformations.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之七&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt; – Resources&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;和&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;Transformations&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-yet-again.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之八&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt; –&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;动画：缓慢旋转的按钮&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-hello-kitty.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之九&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt; – Hello Kitty &lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;专卖店产品演示&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;&lt;img src="http://blog.entlib.com/EntLib/aggbug/127.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>EntLib.com</dc:creator>
            <guid>http://blog.entlib.com/EntLib/archive/2009/01/27/wpf-data-binding.aspx</guid>
            <pubDate>Tue, 27 Jan 2009 01:28:42 GMT</pubDate>
            <wfw:comment>http://blog.entlib.com/EntLib/comments/127.aspx</wfw:comment>
            <comments>http://blog.entlib.com/EntLib/archive/2009/01/27/wpf-data-binding.aspx#feedback</comments>
            <wfw:commentRss>http://blog.entlib.com/EntLib/comments/commentRss/127.aspx</wfw:commentRss>
            <enclosure url="http://blog.entlib.com/userfiles/EntLib/file/GiftCenter_CheckOut.zip" length="56" type="application/octetstream" />
        </item>
        <item>
            <title>XAML 实例演示之九 – Hello Kitty 专卖店产品演示</title>
            <link>http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-hello-kitty.aspx</link>
            <description>&lt;div align="center"&gt;&lt;b&gt;XAML &lt;/b&gt;&lt;b&gt;实例演示之九 – Hello Kitty &lt;/b&gt;&lt;b&gt;专卖店产品演示&lt;/b&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;本文演示如何结合XAML 实例演示系列文章（1-8）中学习的技术，制作一个Hello Kitty 专卖店产品演示窗口。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;范例程序演示效果如下：&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div style="text-align: center;"&gt;&lt;img width="700" height="396" src="/userfiles/EntLib/image/WPF/XAML_HelloKitty_1.gif" alt="" /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;img width="700" height="396" src="/userfiles/EntLib/image/WPF/XAML_HelloKitty_2.gif" alt="" /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;img width="700" height="348" src="/userfiles/EntLib/image/WPF/XAML_HelloKitty_3.gif" alt="" /&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;strong&gt;范例程序完整代码下载：&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/userfiles/EntLib/file/GiftCenter_HelloKitty.zip"&gt;&lt;font color="#0000ff"&gt;http://blog.entlib.com/userfiles/EntLib/file/GiftCenter_HelloKitty.zip&lt;/font&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;因为范例程序引用了&lt;a href="http://www.giftcenter.cn/"&gt;http://www.giftcenter.cn&lt;/a&gt; 礼品中心网-Hello Kitty 专卖店的一些产品图片，因此需要连接Internet 才能看到具体的演示效果。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;本文配合免费下载的Kaxaml 工具，演示XAML 的一些基本用法。关于Kaxaml 工具的介绍和下载，请参考文章：&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/23/xaml-kaxaml.aspx"&gt;&lt;span&gt;&lt;span&gt;推荐一款免费下载&lt;/span&gt; XAML &lt;span&gt;编辑调试工具&lt;/span&gt;-Kaxaml&lt;/span&gt;。&lt;/a&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;XAML 系列文章为学习笔记，这是我今年春节期间安排的学习任务。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;前面系列文章：&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/24/xaml.aspx"&gt;&lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt;XAML &lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt;实例演示之一&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/24/xaml-again.aspx"&gt;&lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt;XAML &lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt;实例演示之二&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/25/xaml-grid.aspx"&gt;&lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt;XAML &lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt;实例演示之三&lt;/span&gt;&lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt; – Grid &lt;/span&gt;&lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt;控件的使用&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/25/xaml-stackpanelflowdocumentreader.aspx"&gt;&lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt;XAML &lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt;实例演示之四&lt;/span&gt;&lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt; – StackPanel&lt;/span&gt;&lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt;和&lt;/span&gt;&lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt;FlowDocumentReader&lt;/span&gt;&lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt;控件的使用&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-canvasviewbox.aspx"&gt;&lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt;XAML &lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt;实例演示之五&lt;/span&gt;&lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt; – Canvas&lt;/span&gt;&lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt;和&lt;/span&gt;&lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt;ViewBox&lt;/span&gt;&lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt;控件的使用&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-nesting.aspx"&gt;&lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt;XAML &lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt;实例演示之六&lt;/span&gt;&lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt; – &lt;/span&gt;&lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt;控件嵌套&lt;/span&gt;&lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt;Nesting&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-resourcestransformations.aspx"&gt;&lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt;XAML &lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt;实例演示之七&lt;/span&gt;&lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt; – Resources&lt;/span&gt;&lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt;和&lt;/span&gt;&lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt;Transformations&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-yet-again.aspx"&gt;&lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt;XAML &lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt;实例演示之八&lt;/span&gt;&lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt; –&lt;/span&gt;&lt;span style="color: rgb(65, 81, 154); text-decoration: none;"&gt;动画：缓慢旋转的按钮&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;下面逐个介绍本范例使用的一些技术。&lt;/div&gt;
&lt;div&gt;&lt;b&gt;1. LinearGrdientBrush &lt;/b&gt;&lt;b&gt;和 GradientStop &lt;/b&gt;&lt;/div&gt;
&lt;div&gt;LinearGradientBrush 使用线性渐变绘制区域。线形渐变横跨一条直线（渐变轴）将两种或更多种色彩进行混合。可以使用 GradientStop 对象指定渐变的颜色及其位置。&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;&amp;lt;LinearGradientBrush &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;x:Key&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="ListBoxGradient" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;StartPoint&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="0,0" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;EndPoint&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="0,1"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;    &amp;lt;GradientStop &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Color&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="#90000000" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Offset&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="0" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;    &amp;lt;GradientStop &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Color&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="#40000000" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Offset&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="0.005" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;    &amp;lt;GradientStop &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Color&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="#10000000" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Offset&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="0.04" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;    &amp;lt;GradientStop &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Color&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="#20000000" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Offset&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="0.945" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;    &amp;lt;GradientStop &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Color&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="#60FFFFFF" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Offset&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="1" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt; &amp;lt;/LinearGradientBrush&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;上述LinearGridentBrush定义在Resources里面，应用在Border元素中。&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 12pt;"&gt;       &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;&amp;lt;Border &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;BorderBrush&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="Red" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;BorderThickness&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="5" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;CornerRadius&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="6" &lt;/span&gt;&lt;b&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Background&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="{DynamicResource ListBoxGradient}"&lt;/span&gt;&lt;/b&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;        &amp;lt;ScrollViewer &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;VerticalScrollBarVisibility&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="Disabled" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;HorizontalScrollBarVisibility&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="Auto"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;          &amp;lt;StackPanel &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;IsItemsHost&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="True" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Orientation&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="Horizontal" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="Left" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;        &amp;lt;/ScrollViewer&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;        &amp;lt;/Border&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;b&gt;2. Style&lt;/b&gt;&lt;b&gt;对象&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;一个控件中Style属性包含着一个Style对象，当Style对象更改时就可更新控件的大小及颜色等属性。XAML对Style的支持很好，一般请况Style初始化在父控件的Resources标记里面做为一个资源等待调用。&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;&amp;lt;Style &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;x:Key&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="SpecialListStyle" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;TargetType&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="{x:Type ListBox}"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt; &amp;lt;Setter &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Property&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="Template"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;    &amp;lt;Setter.Value&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;      &amp;lt;ControlTemplate &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;TargetType&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="{x:Type ListBox}" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;        &amp;lt;Border &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;BorderBrush&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="Red" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;BorderThickness&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="5" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;CornerRadius&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="6" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Background&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="{DynamicResource ListBoxGradient}" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;        &amp;lt;ScrollViewer &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;VerticalScrollBarVisibility&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="Disabled" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;HorizontalScrollBarVisibility&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="Auto"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;          &amp;lt;StackPanel &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;IsItemsHost&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="True" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Orientation&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="Horizontal" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="Left" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;        &amp;lt;/ScrollViewer&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;        &amp;lt;/Border&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;      &amp;lt;/ControlTemplate&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;    &amp;lt;/Setter.Value&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt; &amp;lt;/Setter&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;&amp;lt;/Style&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Style节在父控件Window的Resources属性中，表意Window下所有的子控件都可以获取Window.Resources中的对象。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;Style.Triggers是一个Trigger（触发器）集合。使用了EventTrigger（事件触发器）实现产品图片大小和透明度的动画效果。&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;&amp;lt;Style.Triggers&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;    &amp;lt;EventTrigger &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;RoutedEvent&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="Mouse.MouseEnter"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;    &amp;lt;EventTrigger.Actions&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;      &amp;lt;BeginStoryboard&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;        &amp;lt;Storyboard&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;          &amp;lt;DoubleAnimation &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Duration&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="0:0:0.2" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Storyboard.TargetProperty&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="MaxHeight" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;To&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="310" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;          &amp;lt;DoubleAnimation &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Duration&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="0:0:0.2" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Storyboard.TargetProperty&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="Opacity" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;To&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="1.0" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;        &amp;lt;/Storyboard&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;      &amp;lt;/BeginStoryboard&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;    &amp;lt;/EventTrigger.Actions&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt; &amp;lt;/EventTrigger&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;strong&gt;3. ListBox和ItemsSource&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;ListBox 是一个 ItemsControl，使用 ItemsSource 属性设置其内容。本范例程序将Hello Kitty 专卖店的部分产品图片绑定到ListBox中。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 12pt;"&gt;   &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;&amp;lt;ListBox&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;    &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Style&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="{StaticResource SpecialListStyle}" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Grid.Row&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="1" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Grid.ColumnSpan&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="3" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Name &lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="PhotoListBox" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Margin&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="0,0,0,20"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;    &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;ItemsSource&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="{Binding}" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;ItemContainerStyle&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="{StaticResource SpecialListItem}" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;SelectedIndex&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="0"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;      &amp;lt;Image &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Source&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="http://www.giftcenter.cn/giftcenterpictures/img640/04/102/04-102-013.jpg"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;      &amp;lt;Image &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Source&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="http://www.giftcenter.cn/giftcenterpictures/img640/01/204/01-204-007.jpg"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;      &amp;lt;Image &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Source&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="http://www.giftcenter.cn/giftcenterpictures/img640/02/307/02-307-001.jpg"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;      &amp;lt;Image &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Source&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="http://www.giftcenter.cn/giftcenterpictures/img640/02/314/02-314-004.jpg"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;      &amp;lt;Image &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Source&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="http://www.giftcenter.cn/giftcenterpictures/img640/02/301/02-301-004.jpg"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;      &amp;lt;Image &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Source&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="http://www.giftcenter.cn/giftcenterpictures/img640/02/310/02-310-015.jpg"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;      &amp;lt;Image &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Source&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="http://www.giftcenter.cn/giftcenterpictures/img640/02/310/02-310-020.jpg"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;      &amp;lt;Image &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Source&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="http://www.giftcenter.cn/giftcenterpictures/img640/02/303/02-303-028.jpg"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;      &amp;lt;Image &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Source&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="http://www.giftcenter.cn/giftcenterpictures/img640/02/204/02-204-005.jpg"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;      &amp;lt;Image &lt;/span&gt;&lt;span style="font-size: 10pt; color: red;"&gt;Source&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue;"&gt;="http://www.giftcenter.cn/giftcenterpictures/img640/02/312/02-312-003.jpg"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 10pt; color: darkmagenta;"&gt;    &amp;lt;/ListBox&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;&lt;img src="http://blog.entlib.com/EntLib/aggbug/126.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>EntLib.com</dc:creator>
            <guid>http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-hello-kitty.aspx</guid>
            <pubDate>Mon, 26 Jan 2009 04:37:21 GMT</pubDate>
            <wfw:comment>http://blog.entlib.com/EntLib/comments/126.aspx</wfw:comment>
            <comments>http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-hello-kitty.aspx#feedback</comments>
            <wfw:commentRss>http://blog.entlib.com/EntLib/comments/commentRss/126.aspx</wfw:commentRss>
        </item>
        <item>
            <title>XAML 实例演示之八 –动画：缓慢旋转的按钮</title>
            <link>http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-yet-again.aspx</link>
            <description>&lt;div align="center"&gt;&lt;b&gt;XAML &lt;/b&gt;&lt;b&gt;实例演示之八 –&lt;/b&gt;&lt;b&gt;动画：缓慢旋转的按钮&lt;/b&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;本文配合免费下载的Kaxaml 工具，演示XAML 的一些基本用法。关于Kaxaml 工具的介绍和下载，请参考文章：&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/23/xaml-kaxaml.aspx"&gt;&lt;span&gt;&lt;span&gt;推荐一款免费下载&lt;/span&gt; XAML &lt;span&gt;编辑调试工具&lt;/span&gt;-Kaxaml&lt;/span&gt;。&lt;/a&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;XAML 系列文章为学习笔记，这是我今年春节期间安排的学习任务。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;前面系列文章：&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/24/xaml.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之一&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/24/xaml-again.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之二&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/25/xaml-grid.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之三&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt; – Grid &lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;控件的使用&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/25/xaml-stackpanelflowdocumentreader.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之四&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt; – StackPanel&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;和&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;FlowDocumentReader&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;控件的使用&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-canvasviewbox.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之五&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt; – Canvas&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;和&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;ViewBox&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;控件的使用&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-nesting.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之六&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt; – &lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;控件嵌套&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;Nesting&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-resourcestransformations.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之七&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt; – Resources&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;和&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;Transformations&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;本文介绍了如何实现动画。范例程序简单实现了一个慢慢旋转的按钮。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;在WPF中实现动画，对象必须满足三个条件：&lt;/div&gt;
&lt;div&gt;1. 必须有一个依赖属性（Dependency Property）。&lt;/div&gt;
&lt;div&gt;2. 必须继承DependencyObject对象，并实现了IAnimatable接口。常用的控件Button，Panel和Shape都继承DependencyObject，并实现了IAnimatable接口，因此这不是一个问题。&lt;/div&gt;
&lt;div&gt;3. 必须有一个兼容的动画类型变量。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;实现动画的第一步是选择一个属性来动画。在范例中，我们通过改变Button的角度来实现动画。Angel属性值是Double类型，因此我们使用DoubleAnimation创建从开始值到终点值的渐变。同时，还需要指定Duration属性值，也就是从开始到结束所持续的时间。Duration值越大，动画就会越慢。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;第二步是创建Storyboard，在Storyboard中放置DoubleAnimation元素。DoubleAnimation通过Storyboard.TargetName属性指定在哪里应用动画，也就是指定动画的对象。本范例指定Button按钮应用动画。&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 12pt"&gt;       &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;BeginStoryboard&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;          &amp;lt;Storyboard&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;            &amp;lt;DoubleAnimation&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;            &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Storyboard.TargetName&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="AnimatedRotateTransform"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;            &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Storyboard.TargetProperty&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Angle"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;            &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;To&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="360" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Duration&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="0:0:5" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;FillBehavior&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Stop" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;          &amp;lt;/Storyboard&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;        &amp;lt;/BeginStoryboard&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;最后一步是关联Storyboard和Trigger，也就是指定启动动画的事件。&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;EventTrigger &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;RoutedEvent&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Button.Click"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;完整的范例代码如下：&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;Page &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;xmlns&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;xmlns:x&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="http://schemas.microsoft.com/winfx/2006/xaml"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Title&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;=" Welcome to EntLib.com | Graphics: Animated Rotation"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Background&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="White" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Margin&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="50"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt; &amp;lt;StackPanel&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;    &amp;lt;Button &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Content&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Slow Spinning Button" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Width&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="200" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;RenderTransformOrigin&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="0.5,0.5"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;      &amp;lt;Button.RenderTransform&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;        &amp;lt;RotateTransform &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;x:Name&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="AnimatedRotateTransform" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Angle&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="0" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;      &amp;lt;/Button.RenderTransform&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;      &amp;lt;Button.Triggers&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;        &amp;lt;EventTrigger &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;RoutedEvent&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Button.Click"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;        &amp;lt;BeginStoryboard&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;          &amp;lt;Storyboard&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;            &amp;lt;DoubleAnimation&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;            &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Storyboard.TargetName&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="AnimatedRotateTransform"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;            &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Storyboard.TargetProperty&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Angle"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;            &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;To&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="360" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Duration&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="0:0:5" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;FillBehavior&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Stop" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;          &amp;lt;/Storyboard&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;        &amp;lt;/BeginStoryboard&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;        &amp;lt;/EventTrigger&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;      &amp;lt;/Button.Triggers&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;    &amp;lt;/Button&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt; &amp;lt;/StackPanel&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;/Page&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;演示效果如下：&lt;/div&gt;
&lt;div style="text-align: center"&gt;&lt;img height="255" alt="" width="446" src="/userfiles/EntLib/image/WPF/XAML_SlowSpinningButton.gif" /&gt;&lt;/div&gt;
&lt;div style="text-align: left"&gt; &lt;/div&gt;&lt;img src="http://blog.entlib.com/EntLib/aggbug/125.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>EntLib.com</dc:creator>
            <guid>http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-yet-again.aspx</guid>
            <pubDate>Mon, 26 Jan 2009 00:42:18 GMT</pubDate>
            <wfw:comment>http://blog.entlib.com/EntLib/comments/125.aspx</wfw:comment>
            <comments>http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-yet-again.aspx#feedback</comments>
            <wfw:commentRss>http://blog.entlib.com/EntLib/comments/commentRss/125.aspx</wfw:commentRss>
        </item>
        <item>
            <title>XAML 实例演示之七 – Resources和Transformations</title>
            <link>http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-resourcestransformations.aspx</link>
            <description>&lt;div align="center"&gt;&lt;b&gt;XAML &lt;/b&gt;&lt;b&gt;实例演示之七 – Resources&lt;/b&gt;&lt;b&gt;和Transformations&lt;/b&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;img height="168" alt="" width="158" align="right" src="/userfiles/EntLib/image/WPF/wpf.jpg" /&gt;本文配合免费下载的Kaxaml 工具，演示XAML 的一些基本用法。关于Kaxaml 工具的介绍和下载，请参考文章：&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/23/xaml-kaxaml.aspx"&gt;&lt;span&gt;&lt;span&gt;推荐一款免费下载&lt;/span&gt; XAML &lt;span&gt;编辑调试工具&lt;/span&gt;-Kaxaml&lt;/span&gt;。&lt;/a&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;XAML 系列文章为学习笔记，这是我今年春节期间安排的学习任务。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;前面系列文章：&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/24/xaml.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之一&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/24/xaml-again.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之二&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/25/xaml-grid.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之三&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt; – Grid &lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;控件的使用&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/25/xaml-stackpanelflowdocumentreader.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之四&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt; – StackPanel&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;和&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;FlowDocumentReader&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;控件的使用&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-canvasviewbox.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之五&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt; – Canvas&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;和&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;ViewBox&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;控件的使用&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-nesting.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之六&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt; – &lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;控件嵌套&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;Nesting&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;本文介绍了Resources 和 Transformations的使用。Resources提供了XAML定义和共享对象的方法。我们可以在Page/Window或者在整个应用程序级别上共享Resources。可以通过如下语句定义在单一窗口范围内使用的Resource。&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;Window.Resources&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt; &amp;lt;SolidColorBrush &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;x:Key&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="GreenBrush" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Color&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Green" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt; &amp;lt;SolidColorBrush &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;x:Key&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="WhiteBrush" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Color&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="White" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;/Window.Resources&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;下面的语句将上面定义的Resource运用到Button按钮上。StaticResource关键字表示在编译期间设置Resource，这样不能在运行期间关联到不同的Resource。&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;Button &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Content&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Top Button" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Opacity&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="1" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Background&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="{StaticResource GreenBrush}" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Foreground&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="{StaticResource WhiteBrush}" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;WPF使制作简单转换非常方便。本范例XAML创建了三个按钮，其中第三个按钮运用了RenderTransform，RenderTransform有一个子元素RotateTransform，其Angel 属性设置为45度角，顺时针方向。&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;Button &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Content&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Rotated Button"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;Button.RenderTransform&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;RotateTransform &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Angle&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="45" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;/Button.RenderTransform&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;/Button&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;完整的范例代码如下：&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/userfiles/EntLib/file/Resources_Transformations.zip"&gt;&lt;font color="#0000ff"&gt;http://blog.entlib.com/userfiles/EntLib/file/Resources_Transformations.zip&lt;/font&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;在Kaxaml工具中演示效果如下：&lt;/div&gt;
&lt;div style="text-align: center"&gt; &lt;img height="309" alt="" width="542" src="/userfiles/EntLib/image/WPF/XAML_Resources_Transformations.gif" /&gt;&lt;/div&gt;
&lt;div style="text-align: left"&gt; &lt;/div&gt;&lt;img src="http://blog.entlib.com/EntLib/aggbug/124.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>EntLib.com</dc:creator>
            <guid>http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-resourcestransformations.aspx</guid>
            <pubDate>Sun, 25 Jan 2009 17:17:21 GMT</pubDate>
            <wfw:comment>http://blog.entlib.com/EntLib/comments/124.aspx</wfw:comment>
            <comments>http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-resourcestransformations.aspx#feedback</comments>
            <wfw:commentRss>http://blog.entlib.com/EntLib/comments/commentRss/124.aspx</wfw:commentRss>
        </item>
        <item>
            <title>XAML 实例演示之六 – 控件嵌套Nesting</title>
            <link>http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-nesting.aspx</link>
            <description>&lt;div align="center"&gt;&lt;b&gt;XAML &lt;/b&gt;&lt;b&gt;实例演示之六 – &lt;/b&gt;&lt;b&gt;控件嵌套Nesting&lt;/b&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;img height="168" width="158" align="right" alt="" src="/userfiles/EntLib/image/WPF/wpf.jpg" /&gt;本文配合免费下载的Kaxaml 工具，演示XAML 的一些基本用法。关于Kaxaml 工具的介绍和下载，请参考文章：&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/23/xaml-kaxaml.aspx"&gt;&lt;span&gt;&lt;span&gt;推荐一款免费下载&lt;/span&gt; XAML &lt;span&gt;编辑调试工具&lt;/span&gt;-Kaxaml&lt;/span&gt;。&lt;/a&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;XAML 系列文章为学习笔记，这是我今年春节期间安排的学习任务。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;前面系列文章：&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/24/xaml.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之一&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/24/xaml-again.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之二&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/25/xaml-grid.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之三&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt; – Grid &lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;控件的使用&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/25/xaml-stackpanelflowdocumentreader.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之四&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt; – StackPanel&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;和&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;FlowDocumentReader&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;控件的使用&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-canvasviewbox.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之五&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt; – Canvas&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;和&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;ViewBox&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;控件的使用&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;本文介绍了控件的嵌套使用。XAML允许一个控件嵌套另一个控件。例如，StackPanel嵌套在Button 控件中，接着将其他控件或图形嵌套在StackPanel中。在本范例中，我们将一个水平方向的StackPanel放置在Button控件中，接着放置一个Canvas 画布在StackPanel中，在Canvas画布中，我们又放置了一组椭圆Ellipse 图形，像一个牛眼睛。紧邻着Canvas元素，我们放置一个TextBlock 控件。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;范例代码如下：&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/userfiles/EntLib/file/NestingControls.zip"&gt;&lt;font color="#0000ff"&gt;http://blog.entlib.com/userfiles/EntLib/file/NestingControls.zip&lt;/font&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;在Kaxaml 工具中，看看有趣的效果：&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div style="text-align: center"&gt;&lt;img height="309" alt="" width="542" src="/userfiles/EntLib/image/WPF/XAML_NestingControls.gif" /&gt;&lt;/div&gt;
&lt;div style="text-align: left"&gt; &lt;/div&gt;&lt;img src="http://blog.entlib.com/EntLib/aggbug/123.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>EntLib.com</dc:creator>
            <guid>http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-nesting.aspx</guid>
            <pubDate>Sun, 25 Jan 2009 17:11:03 GMT</pubDate>
            <wfw:comment>http://blog.entlib.com/EntLib/comments/123.aspx</wfw:comment>
            <comments>http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-nesting.aspx#feedback</comments>
            <wfw:commentRss>http://blog.entlib.com/EntLib/comments/commentRss/123.aspx</wfw:commentRss>
        </item>
        <item>
            <title>XAML 实例演示之五 – Canvas和ViewBox控件的使用</title>
            <link>http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-canvasviewbox.aspx</link>
            <description>&lt;div align="center"&gt;&lt;b&gt;XAML &lt;/b&gt;&lt;b&gt;实例演示之五 – Canvas&lt;/b&gt;&lt;b&gt;和ViewBox&lt;/b&gt;&lt;b&gt;控件的使用&lt;/b&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;本文配合免费下载的Kaxaml 工具，演示XAML 的一些基本用法。关于Kaxaml 工具的介绍和下载，请参考文章：&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/23/xaml-kaxaml.aspx"&gt;&lt;span&gt;&lt;span&gt;推荐一款免费下载&lt;/span&gt; XAML &lt;span&gt;编辑调试工具&lt;/span&gt;-Kaxaml&lt;/span&gt;。&lt;/a&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;XAML 系列文章为学习笔记，这是我今年春节期间安排的学习任务。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;前面系列文章：&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/24/xaml.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之一&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/24/xaml-again.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之二&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/25/xaml-grid.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之三&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt; – Grid &lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;控件的使用&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/25/xaml-stackpanelflowdocumentreader.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之四&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt; – StackPanel&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;和&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;FlowDocumentReader&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;控件的使用&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;本文介绍了如何使用Canvas和ViewBox控件制作微笑头像。Canvas 画布布局控件允许对子元素进行绝对定位（absolute positioning）。范例中将Canvas控件放置在ViewBox控件中，这样允许伸展子元素Canvas。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;微笑头像-XAML范例代码如下所示：&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;Window&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;xmlns&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;xmlns:x&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="http://schemas.microsoft.com/winfx/2006/xaml"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Title&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Welcome to EntLib.com | Little Green Man"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;Viewbox&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt; &amp;lt;Canvas &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Width&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="180" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Height&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="180" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Center"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;    &amp;lt;Ellipse &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Canvas.Left&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="10"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Canvas.Top&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="10"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Width&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="160"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Height&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="160"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Fill&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="LimeGreen"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Stroke&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Black" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;    &amp;lt;Ellipse &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Canvas.Left&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="45"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Canvas.Top&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="50"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Width&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="25"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Height&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="25"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Fill&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="White"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Stroke&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Black" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;    &amp;lt;Ellipse &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Canvas.Left&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="52"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Canvas.Top&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="55"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Width&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="10"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Height&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="10"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Fill&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Black"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Stroke&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Black" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;    &amp;lt;Ellipse &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Canvas.Left&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="77.5"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Canvas.Top&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="50"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Width&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="25"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Height&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="25"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Fill&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Yellow"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Stroke&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Black" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;    &amp;lt;Ellipse &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Canvas.Left&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="110"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Canvas.Top&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="50"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Width&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="25"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Height&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="25"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Fill&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="White"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Stroke&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Black" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;    &amp;lt;Ellipse &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Canvas.Left&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="117"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Canvas.Top&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="55"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Width&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="10"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Height&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="10"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Fill&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Black"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Stroke&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Black" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;/&amp;gt; &lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;    &amp;lt;Path &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Data&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="M 50,100 A 30,30 900 0 0 130,100" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Stroke&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Red"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt; &amp;lt;/Canvas&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;/Viewbox&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;/Window&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;在Kaxaml 工具中演示效果如下：&lt;br /&gt;
 &lt;/div&gt;
&lt;div style="text-align: center"&gt;&lt;img height="164" alt="" width="228" src="/userfiles/EntLib/image/WPF/XAML_LittleGreenMan_1.gif" /&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;通过拖拉Windows边框，微笑头像自动放大、缩小。伸展后效果如下：&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div style="text-align: center"&gt;&lt;img height="384" alt="" width="587" src="/userfiles/EntLib/image/WPF/XAML_LittleGreenMan_2.gif" /&gt;&lt;br /&gt;
 &lt;/div&gt;
&lt;div&gt;所有shape 对象 (Ellipse, Line, Path, Polygon, Polyline, 和Rectangle) 有相同的属性，三个常用的属性是：&lt;/div&gt;
&lt;div&gt;Stroke – 表示如何画图形的外框。&lt;/div&gt;
&lt;div&gt;StrokeThickness – 表示图形外框的粗细。&lt;/div&gt;
&lt;div&gt;Fill – 表示如何填充图形内部。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;&lt;img src="http://blog.entlib.com/EntLib/aggbug/122.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>EntLib.com</dc:creator>
            <guid>http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-canvasviewbox.aspx</guid>
            <pubDate>Sun, 25 Jan 2009 17:05:03 GMT</pubDate>
            <wfw:comment>http://blog.entlib.com/EntLib/comments/122.aspx</wfw:comment>
            <comments>http://blog.entlib.com/EntLib/archive/2009/01/26/xaml-canvasviewbox.aspx#feedback</comments>
            <wfw:commentRss>http://blog.entlib.com/EntLib/comments/commentRss/122.aspx</wfw:commentRss>
        </item>
        <item>
            <title>XAML 实例演示之四 – StackPanel和FlowDocumentReader控件的使用</title>
            <link>http://blog.entlib.com/EntLib/archive/2009/01/25/xaml-stackpanelflowdocumentreader.aspx</link>
            <description>&lt;div align="center"&gt;&lt;b&gt;XAML &lt;/b&gt;&lt;b&gt;实例演示之四 – StackPanel&lt;/b&gt;&lt;b&gt;和FlowDocumentReader&lt;/b&gt;&lt;b&gt;控件的使用&lt;/b&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;img height="168" width="158" align="right" alt="" src="/userfiles/EntLib/image/WPF/wpf.jpg" /&gt;本文配合免费下载的Kaxaml 工具，演示XAML 的一些基本用法。关于Kaxaml 工具的介绍和下载，请参考文章：&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/23/xaml-kaxaml.aspx"&gt;&lt;span&gt;&lt;span&gt;推荐一款免费下载&lt;/span&gt; XAML &lt;span&gt;编辑调试工具&lt;/span&gt;-Kaxaml&lt;/span&gt;。&lt;/a&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;XAML 系列文章为学习笔记，这是我今年春节期间安排的学习任务。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;前面系列文章：&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/24/xaml.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之一&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/24/xaml-again.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之二&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/25/xaml-grid.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之三&lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt; – Grid &lt;/span&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;控件的使用&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;本文简单介绍StackPanel 和 FlowDocumentReader控件的使用。StackPanel 像其他的Panel一样，既可以作为一个包容器（Container），也可以放在其他包容器之内。本范例，我们将StackPanel 放置在DockPanel之内。FlowDocumentReader 是一个强大的文档显示工具，包含一个简单的FlowDocument，在FlowDocument 之内有许多Paragraph 元素。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;下面是StackPanel和FlowDocumentReader的一个范例：&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/userfiles/EntLib/file/StackPanel.zip"&gt;http://blog.entlib.com/userfiles/EntLib/file/StackPanel.zip&lt;/a&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;在Kaxaml 工具的演示效果如下：&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div style="text-align: center"&gt;&lt;img height="474" alt="" width="700" src="/userfiles/EntLib/image/WPF/XAML_StackPanel_demo.gif" /&gt;&lt;/div&gt;&lt;img src="http://blog.entlib.com/EntLib/aggbug/121.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>EntLib.com</dc:creator>
            <guid>http://blog.entlib.com/EntLib/archive/2009/01/25/xaml-stackpanelflowdocumentreader.aspx</guid>
            <pubDate>Sun, 25 Jan 2009 03:23:23 GMT</pubDate>
            <wfw:comment>http://blog.entlib.com/EntLib/comments/121.aspx</wfw:comment>
            <comments>http://blog.entlib.com/EntLib/archive/2009/01/25/xaml-stackpanelflowdocumentreader.aspx#feedback</comments>
            <wfw:commentRss>http://blog.entlib.com/EntLib/comments/commentRss/121.aspx</wfw:commentRss>
        </item>
        <item>
            <title>XAML 实例演示之三 – Grid 控件的使用</title>
            <link>http://blog.entlib.com/EntLib/archive/2009/01/25/xaml-grid.aspx</link>
            <description>&lt;div align="center"&gt;&lt;b&gt;XAML &lt;/b&gt;&lt;b&gt;实例演示之三 – Grid &lt;/b&gt;&lt;b&gt;控件的使用&lt;/b&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;img height="168" alt="" width="158" align="right" src="/userfiles/EntLib/image/WPF/wpf.jpg" /&gt;本文配合免费下载的Kaxaml 工具，演示XAML 的一些基本用法。关于Kaxaml 工具的介绍和下载，请参考文章：&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/23/xaml-kaxaml.aspx"&gt;&lt;span&gt;&lt;span&gt;推荐一款免费下载&lt;/span&gt; XAML &lt;span&gt;编辑调试工具&lt;/span&gt;-Kaxaml&lt;/span&gt;。&lt;/a&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;XAML 系列文章为学习笔记，这是我今年春节期间安排的学习任务。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;前面系列文章：&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/24/xaml.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之一&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/24/xaml-again.aspx"&gt;&lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;XAML &lt;span style="color: #41519a; text-decoration: none; text-underline: none"&gt;实例演示之二&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;本文简单介绍Grid 控件的使用。标识（Markup）语言的一个挑战是实现准确的页面元素布局，XAML 实现的方法是采用Panel元素。最灵活的Panel可能就是Grid了，Grid 允许控制行、列，就像HTML语言中的table一样。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;下面是一个简单的Grid控件的范例：&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;Window&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;xmlns&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;xmlns:x&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="http://schemas.microsoft.com/winfx/2006/xaml"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Title&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Programming .NET 3.5 | Understanding Grids"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;Grid&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;Grid.RowDefinitions&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;RowDefinition/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;RowDefinition/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;RowDefinition/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;/Grid.RowDefinitions&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;Grid.ColumnDefinitions&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;ColumnDefinition/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;ColumnDefinition/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;ColumnDefinition/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;/Grid.ColumnDefinitions&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;TextBlock &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;TextBlock.FontSize&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="36"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;TextBlock.Foreground&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="White"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Background&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Blue"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="0"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="0"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Grid.RowSpan&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="2"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkblue"&gt;1&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;/TextBlock&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;TextBlock &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;TextBlock.FontSize&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="36"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Background&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Gold"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="1"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="0" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkblue"&gt;2&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;/TextBlock&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;TextBlock &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;TextBlock.FontSize&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="36"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;TextBlock.Foreground&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="White"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Background&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Crimson"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="2"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="0" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkblue"&gt;3&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;/TextBlock&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;TextBlock &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;TextBlock.FontSize&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="36"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Background&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="White"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="1"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="1"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Grid.ColumnSpan&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="2"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkblue"&gt;4&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;/TextBlock&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;TextBlock &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;TextBlock.FontSize&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="36"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;TextBlock.Foreground&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="White"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Background&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Purple"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="0"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="2" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkblue"&gt;5&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;/TextBlock&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;TextBlock &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;TextBlock.FontSize&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="36"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;TextBlock.Foreground&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="White"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Background&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Green"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="1"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="2" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkblue"&gt;6&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;/TextBlock&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;TextBlock &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;TextBlock.FontSize&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="36"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;TextBlock.Foreground&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="White"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Background&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Black"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="2"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="2" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkblue"&gt;7&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;/TextBlock&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;/Grid&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;/Window&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;在Kaxaml 工具中的演示效果如下：&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div style="text-align: center"&gt;&lt;img height="374" alt="" width="599" src="/userfiles/EntLib/image/WPF/XAML_Grid_demo.gif" /&gt;&lt;br /&gt;
 &lt;/div&gt;
&lt;div&gt;本范例代码首先定义一个Grid 元素，接着分别定义三个 RowDefinitions 和 ColumnDefinitions。接下来逐个定义TextBox元素：&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;TextBlock &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;TextBlock.FontSize&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="36"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;TextBlock.Foreground&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="White"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Background&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Blue"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Grid.Column&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="0"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Grid.Row&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="0"&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 10pt; color: red"&gt;Grid.RowSpan&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="2"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkblue"&gt;1&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;/TextBlock&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;FontSize 指定字体大小，Foreground 指定文字颜色，Column和Row 属性分别指定列、行位置坐标，RowSpan 与 HTML 基本一致，表示占用多少行，类似的一个属性是ColumnSpan。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;有趣的是，Grid 控件自身没有颜色，Grid中的TextBlocks 控件提供颜色，Grid仅仅提供结构定义。&lt;br /&gt;
 &lt;/div&gt;&lt;img src="http://blog.entlib.com/EntLib/aggbug/120.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>EntLib.com</dc:creator>
            <guid>http://blog.entlib.com/EntLib/archive/2009/01/25/xaml-grid.aspx</guid>
            <pubDate>Sun, 25 Jan 2009 03:01:11 GMT</pubDate>
            <wfw:comment>http://blog.entlib.com/EntLib/comments/120.aspx</wfw:comment>
            <comments>http://blog.entlib.com/EntLib/archive/2009/01/25/xaml-grid.aspx#feedback</comments>
            <wfw:commentRss>http://blog.entlib.com/EntLib/comments/commentRss/120.aspx</wfw:commentRss>
        </item>
        <item>
            <title>XAML 实例演示之二</title>
            <link>http://blog.entlib.com/EntLib/archive/2009/01/24/xaml-again.aspx</link>
            <description>&lt;div align="center"&gt;&lt;b&gt;XAML &lt;/b&gt;&lt;b&gt;实例演示之二&lt;/b&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;img height="168" alt="" width="158" align="right" src="/userfiles/EntLib/image/WPF/wpf.jpg" /&gt;本文配合免费下载的Kaxaml 工具，演示XAML 的一些基本用法。关于Kaxaml 工具的介绍和下载，请参考文章：&lt;a href="http://blog.entlib.com/EntLib/archive/2009/01/23/xaml-kaxaml.aspx"&gt;&lt;span&gt;&lt;span&gt;推荐一款免费下载&lt;/span&gt; XAML &lt;span&gt;编辑调试工具&lt;/span&gt;-Kaxaml&lt;/span&gt;。&lt;/a&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;XAML 系列文章为学习笔记，这是我今年春节期间安排的学习任务。&lt;br /&gt;
&lt;br /&gt;
上一篇文章：&lt;br /&gt;
&lt;a id="AggRecentPosts1_RecentPosts_ctl00_Hyperlink2" href="http://blog.entlib.com/EntLib/archive/2009/01/24/xaml.aspx"&gt;&lt;font color="#41519a"&gt;XAML 实例演示之一&lt;/font&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;b&gt;使用DockPanel &lt;/b&gt;&lt;b&gt;和 Border &lt;/b&gt;&lt;b&gt;进行页面布局&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;计划将整个windows Form使用DockPanel和Border控件分为三个区域-Top/Left/Right。下面，首先定义Grid 和 DockPanel 包容器元素。&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;Window&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;xmlns&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: red"&gt;Title&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Welcome" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Height&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="480" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Width&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="690"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;Grid&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt; &amp;lt;DockPanel &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;LastChildFill&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="False"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;接下来是TOP 区域的Border控件定义：&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;Border&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;    &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;DockPanel.Dock&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Top"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;    &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;BorderBrush&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Black"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;    &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;BorderThickness&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="1"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;    &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Height&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="70"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;    &amp;lt;Label&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;    &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;FontFamily&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Verdana"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;    &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;FontSize&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="32"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;    &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Center"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: black"&gt;EntLib.com – &lt;/span&gt;&lt;span style="font-size: 10pt; color: black"&gt;开源&lt;/span&gt;&lt;span style="font-size: 10pt; color: black"&gt;ASP.NET/C# &lt;/span&gt;&lt;span style="font-size: 10pt; color: black"&gt;技术论坛&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;/Label&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt; &amp;lt;/Border&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;左边区域Border 控件的定义：&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;Border&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt; &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;DockPanel.Dock&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Left"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt; &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;BorderBrush&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Black"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt; &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;BorderThickness&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="1"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt; &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Width&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="400"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;    &amp;lt;StackPanel&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;    &amp;lt;Label&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;    &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;FontFamily&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Verdana"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;    &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;FontWeight&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Bold" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;FontSize&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="18"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;    &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Center"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 10pt; color: black"&gt;Left&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;/Label&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;    &amp;lt;/StackPanel&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt; &amp;lt;/Border&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;右边区域 Border 控件的定义：&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;Border&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt; &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;DockPanel.Dock&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Right"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt; &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;BorderBrush&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Black"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt; &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;BorderThickness&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="1"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt; &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Width&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="290"&lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;     &amp;lt;Image &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Name&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="imgLogo" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Margin&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="0, 10, 0, 0" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Center" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="Top"&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: blue"&gt;      &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Source&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="&lt;/span&gt; &lt;span style="font-size: 10pt; color: blue"&gt;http://forum.entlib.com/images/entlib.gif" &lt;/span&gt;&lt;span style="font-size: 10pt; color: red"&gt;Width&lt;/span&gt;&lt;span style="font-size: 10pt; color: blue"&gt;="220" &lt;/span&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt; &amp;lt;/Border&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;最后，关闭相关的控件。&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;/DockPanel&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;/Grid&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 10pt; color: darkmagenta"&gt;&amp;lt;/Window&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;下面是通过Kaxaml 工具的运行效果图：&lt;br /&gt;
 &lt;/div&gt;
&lt;div style="text-align: center"&gt;&lt;img height="480" alt="" width="690" src="/userfiles/EntLib/image/WPF/XAML_Learning2_1.gif" /&gt;&lt;/div&gt;
&lt;div style="text-align: center"&gt; &lt;br /&gt;
 &lt;/div&gt;
&lt;div&gt;下面，进一步采用StackPanel、Label、Separator 控件实现左侧区域的效果。StackPanel 实现控件从上至下摆放，Separator控件用来进一步隔离不同的控件。&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;左侧Border 及其内部控件代码 – 请下载附件中的范例代码。&lt;/div&gt;
&lt;div&gt;通过Kaxaml工具，范例XAML 的最终演示效果如下：&lt;br /&gt;
 &lt;/div&gt;
&lt;div style="text-align: center"&gt;&lt;img height="480" alt="" width="690" src="/userfiles/EntLib/image/WPF/XAML_Learning_3.gif" /&gt; &lt;/div&gt;
&lt;div&gt;&lt;br /&gt;
从上述范例，我们可以看到XAML具有非常强大的界面定义功能，允许我们创建复杂的界面布局和引入本地及Web资源。另外，XAML也可以设计动画，这里就不具体介绍了。&lt;/div&gt;
&lt;div&gt; &lt;br /&gt;
相关链接：&lt;br /&gt;
&lt;a id="AggRecentPosts1_RecentPosts_ctl00_Hyperlink2" href="http://blog.entlib.com/EntLib/archive/2009/01/24/xaml.aspx"&gt;&lt;font color="#41519a"&gt;XAML 实例演示之一&lt;/font&gt;&lt;/a&gt;&lt;br /&gt;
&lt;a id="AggRecentPosts1_RecentPosts_ctl01_Hyperlink2" href="http://blog.entlib.com/EntLib/archive/2009/01/23/xaml-kaxaml.aspx"&gt;&lt;font color="#41519a"&gt;推荐一款免费下载 XAML 编辑调试工具-Kaxaml&lt;/font&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;/div&gt;&lt;img src="http://blog.entlib.com/EntLib/aggbug/119.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>EntLib.com</dc:creator>
            <guid>http://blog.entlib.com/EntLib/archive/2009/01/24/xaml-again.aspx</guid>
            <pubDate>Sat, 24 Jan 2009 15:24:07 GMT</pubDate>
            <wfw:comment>http://blog.entlib.com/EntLib/comments/119.aspx</wfw:comment>
            <comments>http://blog.entlib.com/EntLib/archive/2009/01/24/xaml-again.aspx#feedback</comments>
            <slash:comments>3</slash:comments>
            <wfw:commentRss>http://blog.entlib.com/EntLib/comments/commentRss/119.aspx</wfw:commentRss>
            <enclosure url="http://blog.entlib.com/userfiles/EntLib/file/DockPanel.zip" length="73" type="application/octetstream" />
        </item>
    </channel>
</rss>