WPF中ListView和DataGrid之间的区别? [英] Difference between ListView and DataGrid in WPF?
问题描述
我必须从数据库中检索一些问题并将其动态显示在用户屏幕上.我还需要在网格视图的列中添加一些控件,基本上是一个问题和一个答案输入框.
I have to retrieve some questions from the database and display them on the user screen dynamically. I also need to add some controls in the columns of grid view, basically a question and input box for an answer.
请建议我使用哪一个? ListView
或DataGrid
?
Please suggest which one should I use? ListView
or DataGrid
?
推荐答案
好,在WPF中,ListView
和DataGrid
之间的区别只是一个.编辑中.您需要使用DataGrid
进行编辑,否则请使用ListView
.您也可以在ListView
中进行编辑,但是更容易在DataGrid
中进行构建.否则,可以在ListView
中显示的任何内容都可以在ListView
中显示.
Well, in WPF the difference between ListView
and DataGrid
is just one. Editing. You need editing use DataGrid
, otherwise use ListView
. You can edit in ListView
also but it is easier and build in DataGrid
. Otherwise, whatever can be displayed in DataGrid
, can be displayed in ListView
.
DataGrid
支持但ListView
不支持(开箱即用)的一件事是自动列生成.
One thing which DataGrid
supports and ListView
doesn't (out of the box) is automatic column generation.
您可以阅读有关CodeProject的这篇文章,以更好地理解ListView
和DataGrid
之间的主要区别.
You can read this article on CodeProject for a better understanding of DataGrid
and also about the major differences between ListView
and DataGrid
.
这篇关于WPF中ListView和DataGrid之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!