本文介绍了如何将数据加载到wpf数据网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在我的wpf datagrid中显示一个datatable的内容
I'm trying to display the content of a datatable in my wpf datagrid
在以下帖子中:
我发现代码:
myDataGrid.ItemsSource = myDataTable.DefaultView;
并且行为很奇怪:它显示n个正确的空行:查询结果n
and the behaviour is strange: it shows n empty rows where the n is correct: the query results n rows!
那么为什么我看不到他们?
So why can't I see them?
推荐答案
没有看到代码,我猜想你没有将 AutoGenerateColumns
设置为true。没关系,但是如果您不是自动生成列,则需要手动将列定义添加到数据网格。
Without seeing the code, I would guess that you don't have AutoGenerateColumns
set to to true. That's fine, but if you aren't auto-generating columns, you need to manually add column definitions to your data grid.
这篇关于如何将数据加载到wpf数据网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!