Hi... I have a WinGrid that is non-sortable and users can't move columns. I want to merge matching cells in the first two columns, but the second column should only be merged within the values of the first column.
For example,
NAME POLARIZATION SUBLISTAntenna One VERTICAL 1 Antenna One VERTICAL 2Antenna One VERTICAL 3 Antenna Two VERTICAL 1 Antenna Two VERTICAL 2 Antenna Three HORIZONTAL 1 Antenna Three HORIZONTAL 2Antenna Three HORIZONTAL 3
I want to display as:
NAME POLARIZATION SUBLISTAntenna One VERTICAL 1 2 3 Antenna Two VERTICAL 1 2 Antenna Three HORIZONTAL 1 2 3
Right now the VERTICAL for Antenna One and Antenna Two are also being merged.
Ideas? Thanks... Steve
ultraGrid.DisplayLayout.Override.MergedCellStyle = MergedCellStyle.OnlyWhenSorted;
that's how I do it, it works when the columns are sorted, just hold shift and you will be able to sort multiple columns
also here is a link to help you out a little more, it shows how to make only certain columns merge
http://help.infragistics.com/Help/NetAdvantage/NET/2008.3/CLR2.0/html/WinGrid_Merge_Cells_with_the_Same_Values.html
The problem is that this isn't giving me what I want. See the attachment. The top is what I'm after -- merging of the polarization column within the value of the name column. The bottom is what the grid is giving me.
I finally got around to trying this. The IMergedCellEvaluator worked with some tweaking. Here's what I ended up using for the ShouldCellsBeMerged logic:
Function ShouldCellsBeMerged(ByVal row1 As UltraGridRow, ByVal row2 As UltraGridRow, ByVal column As UltraGridColumn) As Boolean Implements IMergedCellEvaluator.ShouldCellsBeMerged Dim Pol1 As String = DirectCast(row1.GetCellValue(column), String) Dim Pol2 As String = DirectCast(row2.GetCellValue(column), String) Dim Name1 As String = row1.Cells("AntennaName").value Dim Name2 As String = row2.Cells("AntennaName").value Return (Pol1 = Pol2) And (Name1 = Name2)End Function
Many thanks for all the help.
There's no built-in property setting to get the mergind to be dependent on two different columns. But you can code this.The way to do is it you create a class that implements the IMergedCellEvaluator interface. This interface allows you to programmatically determined if two cells should be merged. So in this case, you would create one and assign it to the Polarization column and only merged the cells if the have the same values for both columns.
it looks to me like you are sorting by polarization and then name, try sorting name first and then polaization