1.界面

<UserControl x:Class="HKDCMS.Client.Demo.UIViews.UIControls.AboutUsControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
mc:Ignorable="d"
Background="White"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<Grid.Resources>
<XmlDataProvider x:Key="AllItem" Source="AboutUS.xml" XPath="AboutUS"/>
</Grid.Resources>
<Grid DataContext="{Binding Source={StaticResource AllItem}, XPath=PackageCollection}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Text="{Binding XPath=PackageVersionTitle}" FontSize="18" Margin="2" Grid.Row="0"></TextBlock>
<TextBox TextWrapping="Wrap" AcceptsReturn="True" Name="PackageVersionNameBox"
Text="{Binding XPath=PackageVersionName}" IsReadOnly="True" Grid.Row="1" Margin="5"/>
</Grid>
</Grid>
</UserControl>

2.后台代码

public partial class AboutUsControl : UserControl
{
       public AboutUsControl()
       {
            InitializeComponent();
            XmlDocument doc = new XmlDocument();
            doc.Load("AboutUS.xml");
            XmlDataProvider provider = new XmlDataProvider();
            provider.Document = doc;
            provider.XPath = @"/Note/Body";

}
}

WPF绑定xml数据源的更多相关文章

  1. WPF绑定各种数据源之xml数据源

    一.WPF绑定各种数据源索引 WPF 绑定各种数据源之Datatable WPF绑定各种数据源之object数据源 WPF绑定各种数据源之xml数据源 WPF绑定各种数据源之元素控件属性 Bindin ...

  2. WPF绑定各种数据源之object数据源

    一.WPF绑定各种数据源索引 WPF 绑定各种数据源之Datatable WPF绑定各种数据源之object数据源 WPF绑定各种数据源之xml数据源 WPF绑定各种数据源之元素控件属性 Bindin ...

  3. WPF 绑定一(数据源为控件)

    xaml: <Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.co ...

  4. WPF Binding学习(四) 绑定各种数据源

    转自:http://blog.csdn.net/lisenyang/article/details/18312199 1.集合作为数据源 首先我们先创建一个模型类 public class Stude ...

  5. Telerik XML 数据源绑定的问题

    Telerik GridView 默认的 XElement 数据源的直接绑定,会导致内置的sort, filter ,group等功能无法使用. 原因在于Telerik GridView的那些功能是根 ...

  6. 【WPF】WPF DataGrid List数据源 双向绑定通知机制之ObservableCollection使用以及MultiBinding 的应用

    以下代码实现了DataGrid的简单绑定List数据源 重点要提一下的是,绑定List数据源,但是不能直接用List.比如下面的代码,使用List<GridItem>只能实现数据修改的绑定 ...

  7. WPF 绑定以基础数据类型为集合的无字段名的数据源

    WPF 绑定以基础数据类型为集合的无字段名的数据源 运行环境:Window7 64bit,.NetFramework4.61,C# 6.0: 编者:乌龙哈里 2017-02-21 我们在控件的数据绑定 ...

  8. WPF---数据绑定之Xml数据源(四)

    一.场景 现在外部有一xml文件,我们想将该xml文件中的内容绑定到ListView中,该如何实现? 二.实现 xml文件的内容如下: <?xml version="1.0" ...

  9. WPF快速入门系列(4)——深入解析WPF绑定

    一.引言 WPF绑定使得原本需要多行代码实现的功能,现在只需要简单的XAML代码就可以完成之前多行后台代码实现的功能.WPF绑定可以理解为一种关系,该关系告诉WPF从一个源对象提取一些信息,并将这些信 ...

随机推荐

  1. dedecms在首页或列表调取文章内容body的三个方法

    有时需要在网站首页或栏目封面上显示几篇文章的内页作为导语或其他什么的,但acrlist标签是不能直接调取body的,这时我们就需要使用以下方法来调取body. 方法一:arcticle 标签 加上ch ...

  2. [Leetcode] Decode Ways

    A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' - ...

  3. JAVA反编工具件安装 JD-eclipse

    想看Android  API源码,但是只有class文件,于是找了个反编译工具Java Decompiler,免费的反编译工具.eclipse插件:JD-eclipse. 安装步骤: 1.确保计算机上 ...

  4. 二十四点算法 java实现

    问题: 给出四个数,不可以重复使用,可以用+ - * /和括号,怎么得出24? 代码: //return -1 表示当前方法不行 private int workByStep(int op,int n ...

  5. GridView,Repeater增加自动序号列

    有三种实现的方式, 第一种方式,直接在Aspx页面GridView模板列中.这种的缺点是到第二页分页时又重新开始了. <Columns> <asp:TemplateField Hea ...

  6. MySQL:索引工作原理

    索引查找:通过索引键找到索引的叶子节点,再通过叶子节点的标记快速找到表中对应的行数据,再返回指定的列 索引找查是通过索引键定先位到一块局部区域,再开始扫描匹配的数据的. 为什么需要索引(Why is ...

  7. 那些年一起用过的iOS开发利器之Parse

    阅读此文章需要对Objective-C和iOS有一定的了解,完全没有基础的朋友请先阅读<让不懂编程的人爱上iPhone开发>系列教程. 什么是后台服务(back-end service)? ...

  8. FJNU 1196 汪老司机(DP or 建图+最短路)

    1196: 汪老司机 Time Limit: 1000 MS         Memory Limit: 257792 KB 64-bit interger IO format: %lld       ...

  9. 205 Reset Content

    https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html The server has fulfilled the request and the ...

  10. Thread-Safe Resource Manager

    http://php.net/manual/en/internals2.memory.tsrm.php When PHP is built with Thread Safety enabled, th ...