Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
180
WinGrid Multi Row Column Header Layout
posted

OK.  I need some help.  I am trying to set up a grid that looks something like this:

 

 In the InitializeLayout event I have code to set up the columns based on my Typed Dataset:

        private void gridVDCF_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)

        {

            UltraGridBand band = e.Layout.Bands[0];

 

            int headerPosition = 0;

 

            band.Columns[WorkViewAccountsConstants.COL_DAY].Header.Caption = "";

            band.Columns[WorkViewAccountsConstants.COL_DAY].Width = 75;

            band.Columns[WorkViewAccountsConstants.COL_DAY].Header.VisiblePosition = headerPosition++;

            band.Columns[WorkViewAccountsConstants.COL_DAY].CellActivation = Activation.NoEdit;

           

            band.Columns[WorkViewAccountsConstants.COL_VALUE_DATE].Header.Caption = WorkViewAccountsConstants.DISP_VALUE_DATE;

            band.Columns[WorkViewAccountsConstants.COL_VALUE_DATE].Width = 100;

            band.Columns[WorkViewAccountsConstants.COL_VALUE_DATE].Header.VisiblePosition = headerPosition++;

            band.Columns[WorkViewAccountsConstants.COL_VALUE_DATE].CellActivation = Activation.NoEdit;

 

            band.Columns[WorkViewAccountsConstants.COL_CREDITS_AC].Header.Caption = WorkViewAccountsConstants.DISP_ACCOUNT_CURRENCY;

            band.Columns[WorkViewAccountsConstants.COL_CREDITS_AC].Width = 100;

            band.Columns[WorkViewAccountsConstants.COL_CREDITS_AC].Header.VisiblePosition = headerPosition++;

            band.Columns[WorkViewAccountsConstants.COL_CREDITS_AC].CellActivation = Activation.NoEdit;

 

            band.Columns[WorkViewAccountsConstants.COL_CREDITS_USD].Header.Caption = WorkViewAccountsConstants.DISP_USD;

            band.Columns[WorkViewAccountsConstants.COL_CREDITS_USD].Width = 100;

            band.Columns[WorkViewAccountsConstants.COL_CREDITS_USD].Header.VisiblePosition = headerPosition++;

            band.Columns[WorkViewAccountsConstants.COL_CREDITS_USD].CellActivation = Activation.NoEdit;

 

            band.Columns[WorkViewAccountsConstants.COL_DEBITS_AC].Header.Caption = WorkViewAccountsConstants.DISP_ACCOUNT_CURRENCY;

            band.Columns[WorkViewAccountsConstants.COL_DEBITS_AC].Width = 100;

            band.Columns[WorkViewAccountsConstants.COL_DEBITS_AC].Header.VisiblePosition = headerPosition++;

            band.Columns[WorkViewAccountsConstants.COL_DEBITS_AC].CellActivation = Activation.NoEdit;

 

            band.Columns[WorkViewAccountsConstants.COL_DEBITS_USD].Header.Caption = WorkViewAccountsConstants.DISP_USD;

            band.Columns[WorkViewAccountsConstants.COL_DEBITS_USD].Width = 100;

            band.Columns[WorkViewAccountsConstants.COL_DEBITS_USD].Header.VisiblePosition = headerPosition++;

            band.Columns[WorkViewAccountsConstants.COL_DEBITS_USD].CellActivation = Activation.NoEdit;

 

            band.Columns[WorkViewAccountsConstants.COL_COMMITTED_AC].Header.Caption = WorkViewAccountsConstants.DISP_ACCOUNT_CURRENCY;

            band.Columns[WorkViewAccountsConstants.COL_COMMITTED_AC].Width = 100;

            band.Columns[WorkViewAccountsConstants.COL_COMMITTED_AC].Header.VisiblePosition = headerPosition++;

            band.Columns[WorkViewAccountsConstants.COL_COMMITTED_AC].CellActivation = Activation.NoEdit;

 

            band.Columns[WorkViewAccountsConstants.COL_COMMITTED_USD].Header.Caption = WorkViewAccountsConstants.DISP_USD;

            band.Columns[WorkViewAccountsConstants.COL_COMMITTED_USD].Width = 100;

            band.Columns[WorkViewAccountsConstants.COL_COMMITTED_USD].Header.VisiblePosition = headerPosition++;

            band.Columns[WorkViewAccountsConstants.COL_COMMITTED_USD].CellActivation = Activation.NoEdit;

 

        }

Then I call a method to set up the groups:

        private void SetupGrid()

        {

            UltraGridBand band = this.gridVDCF.DisplayLayout.Bands[0];

 

            //Arrange the band's column in Group Layout style

            band.RowLayoutStyle = RowLayoutStyle.GroupLayout;

 

            UltraGridGroup firstGroup = band.Groups.Add("FirstGroup", "Committed Credits");

            UltraGridGroup secondGroup = band.Groups.Add("SecondGroup", "Committed Debits");

            UltraGridGroup thirdGroup = band.Groups.Add("ThirdGroup", "Value Date Committed Funds");

 

            band.Columns[WorkViewAccountsConstants.COL_CREDITS_AC].RowLayoutColumnInfo.ParentGroup = firstGroup;

            band.Columns[WorkViewAccountsConstants.COL_CREDITS_USD].RowLayoutColumnInfo.ParentGroup = firstGroup;

            band.Columns[WorkViewAccountsConstants.COL_DEBITS_AC].RowLayoutColumnInfo.ParentGroup = secondGroup;

            band.Columns[WorkViewAccountsConstants.COL_DEBITS_USD].RowLayoutColumnInfo.ParentGroup = secondGroup;

            band.Columns[WorkViewAccountsConstants.COL_COMMITTED_AC].RowLayoutColumnInfo.ParentGroup = thirdGroup;

            band.Columns[WorkViewAccountsConstants.COL_COMMITTED_USD].RowLayoutColumnInfo.ParentGroup = thirdGroup;

 

        }

 

I want the non-grouped columns to appear first, but the grid puts the grouped columns first and the non-grouped columns at the end.  Also, I would like the column headers of the non-grouped columns to span vertically - like in the graphic, the ValueDate column is taller.

As a starting point I used this sample:

http://help.infragistics.com/NetAdvantage/WinForms/2010.3/CLR2.0/?page=WinGrid_Grouping_Columns_in_Row_Layout_using_code.html

I feel that I almost got it.  I just need a little assistance to get it to look like I want it to.

Thanks!

 

 

Parents Reply Children
No Data