如何在WPF中对列标题进行分组

时间:2022-03-03 07:37:47

Is it possible to do this in a WPF datagrid :

是否可以在WPF数据网格中执行此操作:

|-------------- A header------------|---------------B Header---------------|

|-----A1Header----|----A2Header-----|-----B1Header-----|-----B2Header------|
|-----A1Data------|----A2 Data------|-----B1 Data------|-----B2 Data-------|
|-----A1Data------|----A2 Data------|-----B1 Data------|-----B2 Data-------|

Thanks.

谢谢。

1 个解决方案

#1


8  

This Thread might help you achieve what you're trying to do.

这个线程可以帮助您实现您想要做的事情。

It doesn't get the functionality directly from the DataGrid, but instead the DataGrid is wrapped in a regular Grid, and uses bound columns (with multi-columnspan) to add super headers.

它不直接从DataGrid获取功能,而是将DataGrid包装在常规Grid中,并使用绑定列(具有多列扩展)来添加超级头。

Hopefully there's a nice easy way to do this directly from the DataGrid, but if not, maybe this will be an acceptable workaround for you.

希望有一个很好的简单方法直接从DataGrid执行此操作,但如果没有,也许这将是一个可接受的解决方法。

#1


8  

This Thread might help you achieve what you're trying to do.

这个线程可以帮助您实现您想要做的事情。

It doesn't get the functionality directly from the DataGrid, but instead the DataGrid is wrapped in a regular Grid, and uses bound columns (with multi-columnspan) to add super headers.

它不直接从DataGrid获取功能,而是将DataGrid包装在常规Grid中,并使用绑定列(具有多列扩展)来添加超级头。

Hopefully there's a nice easy way to do this directly from the DataGrid, but if not, maybe this will be an acceptable workaround for you.

希望有一个很好的简单方法直接从DataGrid执行此操作,但如果没有,也许这将是一个可接受的解决方法。