如何在WPF DataGrid中合并两个单元格? [英] How to merge two cells in wpf datagrid?

查看:625
本文介绍了如何在WPF DataGrid中合并两个单元格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是sarath chandra....

我对wpf很陌生....

我必须在datagrid中显示数据.在这种情况下,我根据条件合并了两个或多个类似Excel的单元格.我必须在后面做代码.


任何机构都可以帮助我........

Hi this is sarath chandra....

I am very much new to wpf.......

I have to display data in datagrid. In that i have merge two or more cells like Excel depending on the condition. I have to do throuh code behind.


Can any body help me........

推荐答案

您在谈论单元"在网格中,您只需要在控件"中根据需要使用"Grid AttachedProperty ColumnSpan"或"RowSpan"即可.

Grid.ColumnSpan =" value "在XAML
Grid.SetColumnSpan( uiElment value )中,在后面的代码中

如果要合并也可以只设置对齐方式直接在控件的VerticalAlignment和Horizo​​ntalAlignment属性中进行设置,因为它将基于封闭的单元格".

You talking about a "cell" in a Grid, you just use Grid AttachedProperty ColumnSpan or RowSpan as needed in the Control that is be placed in the "cell".

Grid.ColumnSpan="value" in XAML
Grid.SetColumnSpan(uiElment, value) in code behind

If you want the merge to also set the alignment just set it directly in the controls VerticalAlignment and HorizontalAlignment properties for it will be base on the enclosing "cell".


这篇关于如何在WPF DataGrid中合并两个单元格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆