列表框与ListView控件 - 如何选择数据绑定 [英] ListBox vs. ListView - how to choose for data binding

查看:152
本文介绍了列表框与ListView控件 - 如何选择数据绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在考虑或者ListBox或WPF应用程序一个ListView。看来无论是支持数据绑定和项模板。我的应用程序,我打算能够搜索/基于用户输入排序/筛选项目的简单列表。数据绑定演示(<一个href=\"http://msdn.microsoft.com/en-us/library/ms771319.aspx\">http://msdn.microsoft.com/en-us/library/ms771319.aspx)使用列表框与CollectionViewSource。

I'm considering either a ListBox or a ListView for a WPF application. It seems either supports data binding and item templates. My application has a simple list of items that I intend to be able to search/sort/filter based on user input. The data binding demo (http://msdn.microsoft.com/en-us/library/ms771319.aspx) uses a ListBox with a CollectionViewSource.

有没有人有优点/缺点为其控制使用,什么时候?

Does anyone have pros/cons for which control to use and when?

推荐答案

一个ListView控件是一个专门列表框(即,它从Control继承)。它允许你指定不同的意见,而不是直清单。你可以推出自己的观点,或使用的GridView(认为类似浏览器的详细信息视图)。它基本上是多列列表框,Windows窗体的列表视图的表弟。

A ListView is a specialized ListBox (that is, it inherits from ListBox). It allows you to specify different views rather than a straight list. You can either roll your own view, or use GridView (think explorer-like "details view"). It's basically the multi-column listbox, the cousin of windows form's listview.

如果您不需要的ListView的附加功能,你当然可以使用列表框,如果你只是显示一个项目列表(即使模板是复杂的)。

If you don't need the additional capabilities of ListView, you can certainly use ListBox if you're simply showing a list of items (Even if the template is complex).

这篇关于列表框与ListView控件 - 如何选择数据绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆