WPF DataGrid中的动态行和列跨度

编程入门 行业动态 更新时间:2024-10-27 00:29:42
本文介绍了WPF DataGrid中的动态行和列跨度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在研究一个新项目,该设计要求以某种网格形式显示动态行和列。我想我可以使用普通的ol'Grid非常巧妙地完成此操作,但似乎应该可以使用真实网格。

I'm working on a new project where the design calls for dynamic rows and columns displayed in some form of grid. I think I can accomplish this very hackishly using the plain ol' Grid, but it seems like it should be possible using a "real" grid.

在我的模型中,我用红色圈出了一些棘手的地方。在第1列下,我实际上有2列数据。问题是我的第1列中的数据可以跨越多行。第一列实际上是两个伪列,每个列可以独立地跨越不同数量的行。注意:数据是伪造的,无关紧要的。我愿意提出一个好的实施方案。我可以退回到Grid并在后面的代码中完成所有操作,我愿意购买一个可能比DataGrid强大的数据网格,而我的 last 绝对选择/偏好是重构这种格式

In my mockup, I circled the tricky bit in red. Under column 1, I have effectively 2 columns of data. The problem is the fact that my data in column 1 can span multiple rows. And the fact that column one is really two pseudo columns and each one can span a different number of rows independently. Note: the data is fake and inconsequential. I'm open to ideas for a good implementation. I can fall back to the Grid and do this all in code behind, I'm open to purchasing a datagrid that may have more power than the DataGrid and my absolute last resort/preference is to restructure this format to something a little more doable.

感谢您提供的任何想法。

Thank you for any ideas you can provide.

推荐答案

大多数商业WPF DataGrid实现都像这样处理分层数据。例如, Telerik的DataGrid (用于WPF的RadControls的一部分)支持分层数据

Most commercial WPF DataGrid implementations handle hierarchical data like this. For example, Telerik's DataGrid (part of RadControls for WPF) supports hierarchical data in multiple formats.

通常,默认样式与上面的样式有所不同,但是可以通过样式适应该格式。

Typically, the default styling is a bit different than yours above, but can be adapted to that format via styling.

更多推荐

WPF DataGrid中的动态行和列跨度

本文发布于:2023-07-08 19:49:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1080002.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:跨度   动态   WPF   DataGrid

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!