合并超网格中的细胞

时间:2019-06-04 20:49:42

标签: ultragrid ultrawingrid

我正在尝试合并超网格中的细胞。

我有这个 abc 50 23 abc 50 37 定义50 37

我想要 abc 50 23        37 定义50 37

his.dgDeviation.DisplayLayout.Bands [0] .Columns [“ Price”]。MergedCellEvaluationType = MergedCellEvaluationType.MergeSameText;

his.dgDeviation.DisplayLayout.Bands [0] .Columns [“ Price”]。MergedCellEvaluationType = MergedCellEvaluationType.MergeSameText; This explains much more what exactly i want to acheive

1 个答案:

答案 0 :(得分:0)

我对此有解决方案

 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();
    }

如果没有自定义合并行为,请尝试尝试合并其单元格,然后考虑/尝试处理网格中的复选框列。