将 WPF DatGrid 绑定到二维数组

发布于 2024-12-29 22:50:49 字数 132 浏览 5 评论 0原文

我在数据绑定方面有一个小问题,事实上我有一个 WPF 项目,其中有一个 DataGrid 控件,我想将其绑定到二维数组,尝试使用 datacontext 直接绑定,但它不起作用,它一直显示错误告诉我该数组不是一维的,任何人都可以告诉我该怎么做吗?谢谢

I have a little problem concerning databinding, infact I have a WPF project where I have a DataGrid Control that I want to bind to a two dimensional array, tried to bind dirrectly using datacontext but it didn't work, it showed all the time an error telling me that the array is not one dimensional, can any one show me how to do ? thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

许一世地老天荒 2025-01-05 22:50:49

这两个问题可能对您有帮助:

如何将 WPF DataGrid 绑定到可变数量的列?

以编程方式添加列和行行到 WPF Datagrid

您需要将数组的一个维度“转换”为列,并将另一个数组维度用作行。

Those two questions might help you:

How do I bind a WPF DataGrid to a variable number of columns?

programmatically add column & rows to WPF Datagrid

You need to 'transform' one dimension of array to columns and use the other array dimension as rows.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文