ヘッダーを固定するかどうかを指定します。ヘッダーを固定すると、グリッドを左右にスクロールしても、そのヘッダーに関連付けられた列は常に表示されたままになります。
ヘッダーを固定するかどうかを指定します。このプロパティは、列ヘッダーとグループヘッダーについて設定可能です。これを BandHeader オブジェクトで設定しようとすると、NonSupportedException が発生します。
このプロパティを有効にするには、UltraGridLayout.UseFixedHeaders を True に設定し、固定ヘッダー機能を有効にする必要があります。
注: 行レイアウトモードではヘッダーを固定できないため、このプロパティは行レイアウトモードでは無視されます。また、グループが存在する場合は、列ヘッダーの Fixed 設定は無視され、グループ ヘッダーの Fixed 設定が使用されます。
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
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { // 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 ) { e.Layout.Bands[1].Columns[0].Header.Fixed = true; e.Layout.Bands[1].Columns[1].Header.Fixed = true; } // 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 ) e.Layout.Bands[1].Override.FixedHeaderIndicator = FixedHeaderIndicator.InSwapDropDown; // For band 2 don't allow the user to be able to fix or unfix columns. if ( e.Layout.Bands.Count > 2 ) e.Layout.Bands[2].Override.FixedHeaderIndicator = FixedHeaderIndicator.None; }