hi,
im looking for a way to span a cell across a row, but only for some rows not for all the rows in the grid
(like creating an unbound column and hiding the columns i want to merge, this will make it for all the rows)
i created a table below witch show a grid with 4 columns, and between some rows in the table
i would like to put a row with only one cell "some single cell row" like in this example
let say i got 4 columns on my grid so
what i tried to do is to use RowLayout and add an extra column to the grid putting the origenX = 0, origenY = 2 to it
and the spanX = 8 spanY = 2 and it put for each row a single cell spaning from one side to another
my problem with that is that i cant hide the cells when i dont need them, since i want to display for each row either the original 4 columns
or the new cell not all of them together
here is my code, if the cell.hide = true whould hide the cell completly it would achive my goal is there a way to do it
or another way to do what i need
{
// Clear the current unbound columns
// Get the header line
string[ headers = headerLine.Split(',');
// Create the column for the header
column.Header.Caption = header;
column.RowLayoutColumnInfo.OriginY = 0;
column.RowLayoutColumnInfo.SpanY = 2;
}
// Create the data column
data.RowLayoutColumnInfo.OriginX = 0;
data.RowLayoutColumnInfo.SpanX = previewFile.NumberOfColumns * 2;
// Hide the columns headers
e.Layout.Bands[0].ColHeadersVisible = false;
if (e.Row.Index < previewFile.HeaderIndex ||
// Hide the rest of the cells
else
// Get the line data
string[ headers = line.Split(',');
// set the columns data
I realize this is a pretty old thread, but just wanted to comment that the idea of overlaying columns by their OriginX and OriginY properties and then showing/hiding the correct ones worked like a champ for me. I never would have thought that was possible. Many thanks for the idea -- it saved me a ton of work (and a lot more Google searching).
Actually, another idea just occurred to me. If you grid had 5 columns, you could position the 4 columns in a row like you have them here, then set the Origin and span of the 5th column to span all the way across the other 4 cells. This means that both sets would occupy the same physical location in the grid. Then all you would have to do is hide either the single cell or the 4 cells on each row of the grid so that the other would show up.
Note that if you went this route, you would have to set the origins and spans of the cells at run-time, because the grid designer will not allow you to have overlapping cells.
The only way to do this would be to use a CreationFilter to extend the cell across the space where there other cells are hidden. This wouldnot be a trivial undertaking, but you if you decide you want to try it, I recommend checking the Infragistics Knowledge Base for sampls and articles on CreationFilters and also get the Infragistics UIElementViewer Utility