WPF ListView ,XML
<?xml version="1.0" encoding="utf-8" ?>
<PersonList>
<Person Id="1">
<Name>Fred</Name>
</Person>
<Person Id="2">
<Name>Sophie</Name>
</Person>
<Person Id="3">
<Name>FR</Name>
</Person>
<Person Id="4">
<Name>FZ</Name>
</Person>
<Person Id="5">
<Name>FY</Name>
</Person>
</PersonList>
<StackPanel>
<ListView x:Name="personListView">
<ListView.View>
<GridView>
<GridViewColumn Header="Id" Width="100" DisplayMemberBinding="{Binding XPath=@Id}"/>
<GridViewColumn Header="Name" Width="100" DisplayMemberBinding="{Binding XPath=Name}"/>
</GridView>
</ListView.View>
</ListView>
<Button x:Name="btn" Width="200" Height="50" Content="Click here" Click="btn_Click"/>
</StackPanel>
using System.XMl;
private void btn_Click(object sender, RoutedEventArgs e)
{
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.Load(@"~\FirstXML.xml");
XmlDataProvider xdp = new XmlDataProvider();
xdp.Document = xmlDocument;
xdp.XPath = @"/PersonList/Person";
this.personListView.DataContext = xdp;
this.personListView.SetBinding(ListView.ItemsSourceProperty, new Binding());
}
WPF ListView ,XML的更多相关文章
- WPF ListView 选中问题
WPF ListView 选中问题 摘自:http://www.cnblogs.com/BBHor/archive/2013/04/28/VisualTreeHelper-PreviewMouseD ...
- [WPF]ListView点击列头排序功能实现
[转] [WPF]ListView点击列头排序功能实现 这是一个非常常见的功能,要求也很简单,在Column Header上显示一个小三角表示表示现在是在哪个Header上的正序还是倒序就可以了. ...
- WPF ListView 居中显示
原文:WPF ListView 居中显示 今天遇到的问题: 方法1:设置GridViewColumn的ActualWidth <ListView > <ListView.View&g ...
- WPF ListView控件设置奇偶行背景色交替变换以及ListViewItem鼠标悬停动画
原文:WPF ListView控件设置奇偶行背景色交替变换以及ListViewItem鼠标悬停动画 利用WPF的ListView控件实现类似于Winform中DataGrid行背景色交替变换的效果,同 ...
- WPF listview item mouse enter/over popup
This is because the routing strategy of the Loaded event is Direct, which means that the routed even ...
- WPF ListView的使用及Linq to XML练习
环境:VS2010 控件:ListView 技术:Linq to XML:MVVM 源码:http://files.cnblogs.com/jumahe/Wpf_Customer.rar 布局描述: ...
- WPF对于xml的简单操作(下)绑定ListView
上个月做好的,电脑给盗了,没及时存在网盘,也及时发到随笔,于是乎悲哉!搞了一个上午终于绑定好了,有时候就是这么眼瞎,Path和XPath全瞎了,摸滚了一个上午,赶紧的随笔跟上先. <ListVi ...
- wpf ListView DataTemplate方式的鼠标悬停和选中更改背景色
今天使用wpf技术弄一个ListView的时候,由于需求需要,需要ListView显示不同的数据模板,很自然的使用了DataTemplate方式来定义多个数据模板,并在ListView中使用ItemT ...
- WPF:ListView 分组合并
CollectionViewSource 绑定的是从数据库取出的数据ListBind 以DeptName为分组依据 <Window.Resources> <CollectionVie ...
随机推荐
- PlayJava Day004
今日所学: /* 2019.08.19开始学习,此为补档. */ JDK 1.6:byte , int , short , char , enum JDK 1.7:byte , int , short ...
- File文件的创建,删除 createNewFile() delete()
package seday03; import java.io.File;import java.io.IOException; /*** 使用File新建一个test1.txt文件* @author ...
- 关于Spring Boot你不得不知道的事
1 Spring Boot官网[2.1.5 CURRENT GA] 1.1 Pivotal Wiki Pivotal Software, Inc. is a software and services ...
- HTML中html元素的lang属性的说明
HTML中html元素的lang属性的说明 我在刚开始学习HTML的时候,关于基本的HTML格式中有一点不明白的地方,基本格式如下 <!DOCTYPE html> <html lan ...
- MySQL 部署分布式架构 MyCAT (三)
配置垂直分表 修改 schema.xml (db1) cd /data/mycat/conf cp schema.xml schema.xml.rwh # 修改配置 vi schema.xml < ...
- 5. this关键字
一.this关键字概述 1. this作为对象的引用,它总是指向调用该方法的对象 2. this的最大作用:让类中的一个方法访问该类中的另一个方法或实例变量 二.this关键字的两种用法 1. 在方法 ...
- Centos 7 LAMP+wordpress
一.简介 LAMP--->Linux(OS).Apache(http服务器),MySQL(有时也指MariaDB,数据库) 和PHP的第一个字母,一般用来建立web应用平台. 它是 ...
- 七,专著研读(Logistic回归)
七,专著研读(Logistic回归) 分类:k-近邻算法,决策树,朴素贝叶斯,Logistic回归,支持向量机,AdaBoost算法. 运用 k-近邻算法,使用距离计算来实现分类 决策树,构建直观的树 ...
- 不获取元素,直接使用id操作dom元素
今天无意中发现个让我很吃惊的问题. 不使用getElementById方法,也可以用id直接操作有id的元素. 继续搜索后,发现name也可以直接操作... 这让我大感意外,了解以后,忍不住写点东西记 ...
- php 学习笔记之日期时间操作一箩筐
格式化日期时间 date : 格式化日期时间 场景 将当前日期时间或者特定日期时间格式化输出为特定格式的字符串,常用于人性化展示信息. 说明 返回给定时间戳格式化后所产生的日期时间字符串,如果没有给出 ...