我正在尝试合并超网格中的单元格。
我有这个ABC 50 23ABC 50 37def 50 37
我要ABC 50 23 37def 50 37
his.dgDeviation.DisplayLayout.Bands[0].列["价格"]。MergedCellEvaluationType = MergedCellEvaluationType.MergeSameText;
his.dgDeviation.DisplayLayout.Bands[0].列["价格"]。MergedCellEvaluationType = MergedCellEvaluationType.MergeSameText;这解释了更多我到底想要实现的目标
我得到了一个解决方案
public class CustomMergedCellEvaluator : Infragistics.Win.UltraWinGrid.IMergedCellEvaluator
{
public bool ShouldCellsBeMerged(UltraGridRow row1, UltraGridRow row2, UltraGridColumn column)
{
// check if the previous column cells are merged.
return (row1.Cells[column.Index - 1].IsMergedWith(row2.Cells[column.Index - 1]));
}
}
然后
private void dgDeviation_InitializeLayout(object sender, InitializeLayoutEventArgs e)
{
this.dgDeviation.DisplayLayout.Bands[0].Columns["ExcludeName"].MergedCellStyle = MergedCellStyle.Always;
this.dgDeviation.DisplayLayout.Bands[0].Columns["ExcludeName"].MergedCellEvaluator = new CustomMergedCellEvaluator();
}
如果没有自定义合并行为,想想/尝试如果我们尝试合并其单元格,网格中的复选框列会发生什么。