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
135
Fixed Columns not working as expected with multibands
posted

HI,

I have a grid of data with multiple bands, each band has the same columns.  I want to freeze the first column in each band so that when you scroll to the right you always have that column visible.

To do this I have this at the end of my InitialiseRow method:

      for (int i = 0; i < _positionsGrid.DisplayLayout.Bands.Count; i++)
      {
        _positionsGrid.DisplayLayout.Bands[i].UseRowLayout = false;
        _positionsGrid.DisplayLayout.Bands[i].Columns[0].Header.Fixed = true;
      }

But when the grid appears it only freezes the column at the lowest band, so when I scroll that column remains fixed but that the columns in the uppers band scroll.

Am I doing something wrong?

 

  • 1210
    Offline posted

    You might want to consider moving the code to InitializeLayout as you only need to run it once and not every time a row is initialized.

    I'm guessing that you have hidden columns in the bands where no column is frozen. You could try accessing first visible column, e.g. something like this:

     

     

     

     

     

     

     

    Dim band As UltraGridBand
    Dim col As UltraGridColumn

    For Each band In e.Layout.Bands
      col = band.GetFirstVisibleCol(e.Layout.ColScrollRegions(0), False, False)
      col.Header.Fixed = True
    Next