Version

Setting the Order for Sibling Child Bands

WinGrid™ displays sibling child bands in the order in which they are provided by the BindingManager and previously there was no way to change this order. But now, a new VisiblePosition property has been added to the UltraGridBand. This new property will default to 0 for all bands. When the WinGrid displays sibling bands, it will sort them based on the VisiblePosition from lowest to highest. So sibling bands with the lowest VisibilePosition will appear first and those with the highest VisiblePosition will appear last.

Note
Note

When two bands have the same VisiblePosition (as they all will by default), then the grid will fall back to the old behavior of displaying in the order in which they were provided by the binding manager and use the Index of the band; the lowest index will appear first.

Consider the WinGrid control bound to an instance of the Customers DataTable from the Northwind database. Customers DataTable will be the parent band(band[0]). Let the two sibling child bands be Order DataTable and CustomerCustomerDemo DataTable from the Northwind database. The following code, changes the order of the sibling child bands so that the CustomerCustomerDemo table is displayed first followed by the Orders table, which is reverse of the default display.

In Visual Basic:

'Displays CustomerCustomerDemo DataTable as the first sibling child band to the Customers parent band
Me.ultraGrid1.DisplayLayout.Bands(2).VisiblePosition = 0
'Displays Orders DataTable as the second sibling child band to the Customers parent band
Me.ultraGrid1.DisplayLayout.Bands(1).VisiblePosition = 1

In C#:

//Displays CustomerCustomerDemo DataTable as the first sibling child band to the Customers parent band
this.ultraGrid1.DisplayLayout.Bands[2].VisiblePosition = 0;
//Displays Orders DataTable as the second sibling child band to the Customers parent band
this.ultraGrid1.DisplayLayout.Bands[1].VisiblePosition = 1;

The WinGrid control displays the CustomerCustomerDemo table as the first child band and displays the Orders table as the second child band.

WinGrid Setting the Order for Sibling child bands.png