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
120
How to add UltraGridGroup via UltraGrid designer?
posted

I have 10 columns in an ultra grid, with 1st 4 needing to be in 1 group, and the last 6 in the 2nd group.

How do I add these UltraGridGroup using the designer to my ultragrid/band[0] using the designer? 

I am a huge fan of visual designers, and promote avoiding writing code that can be done by a visual designer.

The code for the above would be exactly what's in the reference doc, but I would want to do this via the ultra grid designer:

        private void button28_Click(object sender, System.EventArgs e)
        {
 
            // Get the band to have the groups in.
            UltraGridBand band = this.ultraGrid1.DisplayLayout.Bands[0];
             
            UltraGridGroup group1 = null;
            UltraGridGroup group2 = null;
                     
            // Clear existing groups if any.
            band.Groups.Clear( );
                 
            // Add two groups with two different keys. First arguement to the Add call is
            // the key and the second arguement is the caption of the group.
            group1 = band.Groups.Add( "Group1", "Address Info" );
            group2 = band.Groups.Add( "Group2", "Contact Info" );
             
            // If you don't want group headers displayed, set this to false. By default 
            // it's true.
            band.GroupHeadersVisible = false;
             
            // Set the LevelCount to desired number of levels. Level 0 is the first row in
            // the group, while level 1 is the second row in the group and so on. Here we 
            // are going to have 2 levels.
            band.LevelCount = 2;
             
            // Add ContactName column to the first level (level 0) of group1 with visible 
            // position of 0 (meaning it will appear first in that level. There is only 
            // one header in this particular level level anyways.)
            group1.Columns.Add( band.Columns["ContactName"],   0,   0 );
             
            // Add City column to second level (level 1) with visible position of 0. And 
            // also add the Country column to the same level with the visible position of 
            // 1 so that it appears after City column.
            group1.Columns.Add( band.Columns["City"],          0,   1 );
            group1.Columns.Add( band.Columns["Country"],       1,   1 );
             
            // Add Fax and Phone columns to group2 on different levels.
            group2.Columns.Add( band.Columns["Fax"],           0,   0 );
            group2.Columns.Add( band.Columns["Phone"],           0,   1 );
 
            // Prevet the users from moving groups and columns by setting AllowGroupMoving 
            // and AllowColMoving to NotAllowed.
            band.Override.AllowGroupMoving = AllowGroupMoving.NotAllowed;
            band.Override.AllowColMoving   = AllowColMoving.NotAllowed;
             
            // One could change the various properties like RowSpacingAfter and 
            // BorderStyleRow on the Override change the appearance.
            band.Override.RowSpacingAfter = 5;
            band.Override.BorderStyleRow = Infragistics.Win.UIElementBorderStyle.Raised;
 
        }

Parents Reply Children
No Data