hi there !
my name is robin
i'm studying c# & winforms . i want to make datagrid like atatched file
but can't combine column1 in 2 rows(row0 and row1)
my soure code is like this
UltraGridUtil.InitColumnUltraGrid(ug_IssueList, "CLAIM_CODE", "quality issue", true, GridColDataType_emu.VarChar, 60, 10, "", Infragistics.Win.HAlign.Center, true, false); UltraGridUtil.InitColumnUltraGrid(ug_IssueList, "OCC_DATE_Y", "year", true, GridColDataType_emu.VarChar, 50, 10, "", Infragistics.Win.HAlign.Center, true, false); UltraGridUtil.InitColumnUltraGrid(ug_IssueList, "OCC_DATE_M", "month", true, GridColDataType_emu.VarChar, 50, 10, "", Infragistics.Win.HAlign.Center, true, false); UltraGridUtil.InitColumnUltraGrid(ug_IssueList, "OCC_DATE_D", "date", true, GridColDataType_emu.VarChar, 50, 10, "", Infragistics.Win.HAlign.Center, true, false);
UltraGridUtil.ColumnHeaderGroup(this.ug_IssueList, "group1", "quality issue", "CLAIM_CODE"); UltraGridUtil.ColumnHeaderGroup(this.ug_IssueList, "group2", "occur date", "OCC_DATE_Y,OCC_DATE_M,OCC_DATE_D");
plz send me reply if you know :(
Hi Robin,
Thank you for contacting Infragistics Developer Support.
What you could do in your case is to use RowLayouts. Row layouts give you a great deal of flexibility when designing WinGrid's format in your application.
I have attached a sample, which shows how you can achieve the layout from your screenshot. I have done it through code and you can also use the WinGrid’s designer to achieve the same result. For more information on how to do it and on RowLayouts in general, please visit this link:
http://help.infragistics.com/Doc/WinForms/2013.2/CLR4.0/?page=WinGrid_Row_Layouts.html
Please let me know if you have any additional questions.
hello again mitko !
i could handle it using by "RowLayoutColumnInfo.SpanY" like this
-> band.Columns["ISSUE_NO"].RowLayoutColumnInfo.SpanY *= 2;
really thanx again : )
If you use RowLayouts you can’t move the columns using the VisiblePosition header. What you can do instead is to use the Swap method of the UltraGridColumn. The following line will move the third column in the place of the first one:
ultraGrid1.DisplayLayout.Bands[0].Columns[2].Swap(ultraGrid1.DisplayLayout.Bands[0].Columns[0]);
hi mitko
thanx for your reply.
but actually i want to change like below 1st picture to 2nd picture .
but when i use ultraGrid1.DisplayLayout.Bands[0].Columns[2].Swap(ultraGrid1.DisplayLayout.Bands[0].Columns[0]); this, it changed like 1st picture to 3rd picture.
Thank you for the provided screenshots.
Another way to control the columns horizontal position is to manipulate their OriginX property. You can set the OriginX of the column you want to move to the OriginX property of the destination column. After that you have to take into account the other columns you have to move in order to preserve the grid column layout. Please note that this approach can affect the column layout if you try to place the column in a place where it simply won’t fit and it doesn’t adjust other properties as OriginY, SpanX and SpanY – it only moves the columns horizontally. That is why I believe that letting the user move the columns is a better approach when using row layout. You can enable that feature using the following line:
ultraGrid1.DisplayLayout.Override.AllowColMoving = AllowColMoving.WithinBand;
I have attached a sample which demonstrates my suggestion. Please examine it closely, so you can decide if it fits your scenario.
Hi mitko : )
finaly i could solve this problem using your sample source code.
really appreciate to you.
if i have other question someday then i'll ask you again (if u don't mind haha )
thanx again and have a great day!
Feel free to ask me any questions you may have through either a forum post or a private case.
Thank you for using Infragistics components.