<Window x:Class="WpfTutorialSamples.ListView_control.ListViewGridViewSample"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="ListViewGridViewSample" Height="200" Width="400">
    <Grid>
                <ListView Margin="10" Name="lvUsers">
                        <ListView.View>
                                <GridView>
                                        <GridViewColumn Header="Name" Width="120" DisplayMemberBinding="{Binding Name}" />
                                        <GridViewColumn Header="Age" Width="50" DisplayMemberBinding="{Binding Age}" />
                                        <GridViewColumn Header="Mail" Width="150" DisplayMemberBinding="{Binding Mail}" />
                                </GridView>
                        </ListView.View>
                </ListView>
        </Grid>
</Window>
namespace WpfTutorialSamples.ListView_control
{
        public partial class ListViewGridViewSample : Window
        {
                public ListViewGridViewSample()
                {
                        InitializeComponent();
                        List<User> items = new List<User>();
                        items.Add(new User() { Name = "John Doe", Age = 42, Mail = "john@doe-family.com" });
                        items.Add(new User() { Name = "Jane Doe", Age = 39, Mail = "jane@doe-family.com" });
                        items.Add(new User() { Name = "Sammy Doe", Age = 7, Mail = "sammy.doe@gmail.com" });
                        lvUsers.ItemsSource = items;
                }
        }         public class User
        {
                public string Name { get; set; }                 public int Age { get; set; }                 public string Mail { get; set; }
        }
}

wpf listview的更多相关文章

  1. WPF ListView 选中问题

    WPF ListView 选中问题  摘自:http://www.cnblogs.com/BBHor/archive/2013/04/28/VisualTreeHelper-PreviewMouseD ...

  2. [WPF]ListView点击列头排序功能实现

    [转]   [WPF]ListView点击列头排序功能实现 这是一个非常常见的功能,要求也很简单,在Column Header上显示一个小三角表示表示现在是在哪个Header上的正序还是倒序就可以了. ...

  3. WPF ListView 居中显示

    原文:WPF ListView 居中显示 今天遇到的问题: 方法1:设置GridViewColumn的ActualWidth <ListView > <ListView.View&g ...

  4. WPF ListView控件设置奇偶行背景色交替变换以及ListViewItem鼠标悬停动画

    原文:WPF ListView控件设置奇偶行背景色交替变换以及ListViewItem鼠标悬停动画 利用WPF的ListView控件实现类似于Winform中DataGrid行背景色交替变换的效果,同 ...

  5. 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 ...

  6. wpf ListView DataTemplate方式的鼠标悬停和选中更改背景色

    今天使用wpf技术弄一个ListView的时候,由于需求需要,需要ListView显示不同的数据模板,很自然的使用了DataTemplate方式来定义多个数据模板,并在ListView中使用ItemT ...

  7. WPF ListView点击删除某一行并获取绑定数据

    最近在开发WPF程序时遇到一个问题,在gridview中希望实现在每一行最后添加一个删除的按钮,但是发现点击每行的button时只会触发button的点击事件,并没有选中这一行,此时调用list.Se ...

  8. wpf listview 换行

    <ListView  Name="listView1" VerticalAlignment="Top" Height="600" Ma ...

  9. WPF ListView 排序

    代码如下: list为ListView组件.Score为要排序的列,也是绑定的属性. CollectionViewSource.GetDefaultView(list.ItemsSource).Sor ...

随机推荐

  1. Android中利用AIDL机制调用远程服务

    服务端: //CalculateInterface.aidl package com.itheima.aidl.calculate; interface CalculateInterface { do ...

  2. python httplib get和post获取数据

    httplib 下的 status http请求的状态  200 404 500... reason 返回答复 OK或者 FAULRE read()  读取内容 get方法: #!/usr/bin/e ...

  3. Python迭代器,可迭代对象,生成器

    迭代器 迭代器(iterator)有时又称游标(cursor)是程式设计的软件设计模式,可在容器物件(container,例如链表或阵列)上遍访的界面,设计人员无需关心容器物件的内存分配的实现细节. ...

  4. 关于php编程的一些小技巧

    1. NULL,0和空的区分判断 (1)0与空的区分 <?php  $a = 0;if($a==''){ echo '此判断条件不能区分';}else{ echo '此判断条件可以区分';} ? ...

  5. CocoaPods升级,升级以后出现bug的解决方法(升级必看!)

    命令行更新(安装)步骤[更新步骤] $ sudo gem update --system // 先更新gem,国内需要切换源 $ gem sources --remove https://rubyge ...

  6. springmvc 格式化使用Jackjson格式化报Failed to write HTTP message

    Failed to write HTTP message: org.springframework.http.converter.HttpMessageNotWritableException: Co ...

  7. 使用django开发博客过程记录3——博客侧栏实现

    说起这个侧栏真是苦恼我很长时间,一开始以为和之前的一样传递额外参数就可以了就像下面这样: class IndexView(ListView): template_name = 'apps/index. ...

  8. redis技巧--自动完成功能实现

    自动完成功能一般都伴随搜索框出现,就是用户在输入时帮助其自动补全. 比如对成语进行补全,现有如下成语:一心一意,一心二用,一帆风顺. 两种实现方式: 实现方式一: 为每个成语的每个前缀都使用一个集合类 ...

  9. Eclipse中的搜索快捷键

    Ctrl+H 全文搜索Ctrl+F 当前文件Ctrl+Shift+T 类文件Ctrl+Shift+R 资源文件

  10. Linux 从零开始

    从Windows进入linux有太多不适应,对代码一无所知,接触Linux,从简单的开始垒砌. 加油最好的自己!