开发者

Dynamic row and column span in WPF DataGrid

开发者 https://www.devze.com 2023-02-07 05:08 出处:网络
I\'m working on a new project whe开发者_运维百科re 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,

I'm working on a new project whe开发者_运维百科re 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.

Dynamic row and column span in WPF DataGrid

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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消