我必须从数据库中检索一些问题并将它们动态显示在用户屏幕上。我还需要在 GridView 的列中添加一些控件,基本上是一个问题和答案的输入框。
请建议我应该使用哪一个? ListView
还是 DataGrid
?
最佳答案
嗯,在 WPF 中,ListView
和 DataGrid
之间的区别只是其中之一。编辑。您需要使用DataGrid
进行编辑,否则使用ListView
。您也可以在 ListView
中进行编辑,但在 DataGrid
中构建更容易。否则,任何可以在 DataGrid
中显示的内容,都可以在 ListView
中显示。
DataGrid
支持而 ListView
不支持(开箱即用)的一件事是自动列生成。
您可以阅读this article on CodeProject为了更好地理解 DataGrid
以及 ListView
和 DataGrid
之间的主要区别。
关于.net - WPF 中 ListView 和 DataGrid 的区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4765080/