Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
    Private Sub UltraGrid1_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles UltraGrid1.InitializeLayout
        ' Turn on the fixed headers functionality. This will case the row selectors to
        ' be fixed.
        e.Layout.UseFixedHeaders = True
        ' Fix the second column. This will cause this column to be moved before any
        ' non-fixed columns.
        e.Layout.Bands(0).Columns(1).Header.Fixed = True
        ' Different bands could have different number of fixed columns.
        If e.Layout.Bands.Count > 1 Then
            e.Layout.Bands(1).Columns(0).Header.Fixed = True
            e.Layout.Bands(1).Columns(1).Header.Fixed = True
        End If
        ' Set the appearance of fixed headers.
        e.Layout.Override.FixedHeaderAppearance.BackColor = Color.LightYellow
        e.Layout.Override.FixedHeaderAppearance.ForeColor = Color.Blue
        ' Set the appearance of cells associated witht any fixed headers.
        e.Layout.Override.FixedCellAppearance.BackColor = Color.LightYellow
        e.Layout.Override.FixedCellAppearance.ForeColor = Color.Blue
        ' Set the color of the separator line the separates the fixed cells
        ' from non-fixed cells.
        e.Layout.Override.FixedCellSeparatorColor = Color.Red
        ' Set the type of ui that should be presented to the user for fixing and
        ' unfixing columns. Button displays a fixed header indicator button which
        ' when clicked upon will toggle the fixed state of the header.
        e.Layout.Override.FixedHeaderIndicator = FixedHeaderIndicator.Button
        ' For band 1 make use of the swap drop down ui. There will be [Fix Header] and
        ' [Unfix Header] items in swap drop down.
        If e.Layout.Bands.Count > 1 Then
            e.Layout.Bands(1).Override.FixedHeaderIndicator = FixedHeaderIndicator.InSwapDropDown
        End If
        ' For band 2 don't allow the user to be able to fix or unfix columns.
        If e.Layout.Bands.Count > 2 Then
            e.Layout.Bands(2).Override.FixedHeaderIndicator = FixedHeaderIndicator.None
        End If
    End Sub