Home > Net >  The WPF GridControl merger control cell, click merge cells, this would happen
The WPF GridControl merger control cell, click merge cells, this would happen

Time:11-19


Merge cells into three cell, pay to merge the code is as follows:
///& lt; summary>
///used for cell merge
///& lt;/summary>
///& lt; Param name="sender" & gt;
///& lt; Param name="e" & gt;
Private void TableView_CellMerge (object sender, DevExpress Xpf. Grid. CellMergeEventArgs e)
{
Int rowHandle1="e.R owHandle1;
Int rowHandle2="e.R owHandle2;
ListString id1=list [rowHandle1]. Id;
String id2=list [rowHandle2]. Id;

If (id1!=id2)//if two rows id is different, so the same value does not need to merge
{
E.M erge=false;//the same value of 2 cell whether to merge together
E.H andled=true;//merge cells is already processed, without again absent treatment

}
}

CodePudding user response:

Obtain two lines, access to resources, looked at two rows from a resource id, if the id is different is not merged, to merge, the last to merge logic does not write,

CodePudding user response:

Give you a I had written a merger, I was using a DEV controls

CodePudding user response:

引用 2nd floor 不争 的回复:
给你一段我当初写过的合并吧, 我用的是DEV的 控件

See, you are using is DEV is to say,
Private void bandedGridView1_CellMerge (object sender, DevExpress XtraGrid. Views. Grid. CellMergeEventArgs e)
{
If (" e.R owHandle1==bandedGridView1. RowCount)
{
return;
}

Int rowHandle1="e.R owHandle1;
Int rowHandle2="e.R owHandle2;
String strValue1=bandedGridView1. GetDataRow (rowHandle1) [r]. "ITEM_ID" ToString ();//get score column values
String strValue2=bandedGridView1. GetDataRow (rowHandle2) [r]. "ITEM_ID" ToString ();



If (strValue1!=strValue2)
{
E.M erge=false;//the same value of 2 cell whether to merge together
E.H andled=true;//merge cells is already processed, without again absent treatment
}
The else
{
if (! E.c. with our fabrication: olumn. FieldName. Equals (" EstimatedNum ") & amp; & ! E.c. with our fabrication: olumn. FieldName. Equals (" ProjectTask ") & amp; & ! E.c. with our fabrication: olumn. FieldName. Equals (" GroupUser ") & amp; & ! ClientName e.c. with our fabrication: olumn. FieldName. Equals (" "))//only merge to score this column, the other columns are not merge
{
E.M erge=false;//the same value of 2 cell whether to merge together
E.H andled=true;//merge cell operation is already processed, no longer need to be absent treatment
}
}
  • Related