Hello,
i have a scenario in which i have to display data in the ultragrid in such a way that ultragridRow layout style should be used together with some merged cells but unforturnately i did'nt get the desired result, i first applying row layout info to the cells and then apply merged cells to the grid but the merging of cells does not seems to work,kindly help me out if these two features can be used together, and if yes then what should be done first either the rowlayout info to the grid applied first or the merge cell settings should be applied first
any sort of help will be highly appreciated
Regards
Hi,
I tried out your code in a small sample and the first column ("Absolute/Tracking") is spanning across the entire row and there are 3 cells below it. So it would be physically impossible for this cell to be merged without it covering up the other 3 cells in each row.
So I'm confused about what you want to happen here.
HI,
here is my code sample , i have a datatable that i bound to the wingrid at runtime having 4 columns as 'Absolute/Tracking',val,'Risk,Return... i want to merge the column 'Absolute/Tracking' in such a way in RowLayout style that is describing with the code below i added this code at the UltraGrid_InitializeLayout event the code is below. I want to show the merged cell(Absolute/Tracking) as a top row merging cells horizontally. but i don't get the desired results merging has not been done to the desired column
// Applying Row Layout ///
e.Layout.Bands[0].RowLayoutStyle = RowLayoutStyle.ColumnLayout; e.Layout.Bands[0].Columns["Absolute/Tracking"].RowLayoutColumnInfo.OriginX = 0; e.Layout.Bands[0].Columns["Absolute/Tracking"].RowLayoutColumnInfo.OriginY = 0; e.Layout.Bands[0].Columns["Absolute/Tracking"].RowLayoutColumnInfo.SpanX = 8; e.Layout.Bands[0].Columns["Absolute/Tracking"].RowLayoutColumnInfo.SpanY = 2; e.Layout.Bands[0].Columns["Absolute/Tracking"].RowLayoutColumnInfo.PreferredCellSize = new System.Drawing.Size(130, 0); e.Layout.Bands[0].Columns["Absolute/Tracking"].RowLayoutColumnInfo.LabelPosition = LabelPosition.None; e.Layout.Bands[0].Columns["val"].RowLayoutColumnInfo.OriginX = 0; e.Layout.Bands[0].Columns["val"].RowLayoutColumnInfo.OriginY = 2; e.Layout.Bands[0].Columns["val"].RowLayoutColumnInfo.SpanX = 2; e.Layout.Bands[0].Columns["val"].RowLayoutColumnInfo.SpanY = 0; //e.Layout.Bands[0].Columns["val"].RowLayoutColumnInfo.PreferredCellSize = new System.Drawing.Size(130, 0); e.Layout.Bands[0].Columns["Risk"].RowLayoutColumnInfo.OriginX = 4; e.Layout.Bands[0].Columns["Risk"].RowLayoutColumnInfo.OriginY = 2; e.Layout.Bands[0].Columns["Risk"].RowLayoutColumnInfo.SpanX = 2; e.Layout.Bands[0].Columns["Risk"].RowLayoutColumnInfo.SpanY = 0; e.Layout.Bands[0].Columns["Return"].RowLayoutColumnInfo.OriginX = 6; e.Layout.Bands[0].Columns["Return"].RowLayoutColumnInfo.OriginY = 2; e.Layout.Bands[0].Columns["Return"].RowLayoutColumnInfo.SpanX = 2; e.Layout.Bands[0].Columns["Return"].RowLayoutColumnInfo.SpanY = 0; // **** Now merging the cell ****///
e.Layout.Bands[0].Columns["Absolute/Tracking"].MergedCellStyle = MergedCellStyle.Always; e.Layout.Bands[0].Columns["Absolute/Tracking"].MergedCellContentArea = MergedCellContentArea.VirtualRect; e.Layout.Bands[0].Columns["Absolute/Tracking"].MergedCellEvaluationType = MergedCellEvaluationType.MergeSameText;
any help is highly appreciated!
I tested this out recently, and it seems to work just fine for me. It should not matter which you apply first, and in fact, there really is no "first" in such a case, the RowLayout and the cell merging are both defined before the grid paints if you set them up at design-time or in the InitializeLayout event of the grid.
Can you post a sample demonstrating what's not working?