バージョン

Override プロパティ (UltraGridLayout)

UltraGridOverride オブジェクトを設定します。オブジェクトに UltraGridOverride を適用すると、オブジェクトのデフォルト動作は UltraGridOverride の設定によって指定される動作で置き換えられます。DisplayLayout オブジェクトは、すべての UltraGridBands のデフォルト設定を決定する Override プロパティ設定を持ちます。UltraGridBand オブジェクトは、バンド固有の設定に対する Override プロパティも持ちます。
シンタックス
'宣言
 
Public Property Override As UltraGridOverride
public UltraGridOverride Override {get; set;}
解説

UltraWinGrid は階層データで作業することを主として設計されているので、階層的な概念は多くのレベルでコントロールに組み込まれます。グリッドの基本的なデザイン属性のひとつは、コントロールを構成するオブジェクトが階層に存在し、階層式の他のオブジェクトによって影響されます。継承の概念を通して、グリッドのオブジェクトは、指定した階層でプロパティに存在するオブジェクト設定からプロパティの設定を派生できます。

UltraWinGrid にある 2 つの主要な階層は、Appearance および Override 階層です。Appearance 階層は、色、フォント、透過に関係するプロパティなどのオブジェクトの外観に影響するプロパティ設定を継承するために Grid オブジェクトに手段を提供します。Override 階層は外観に関係する必要がないグリッドの他のプロパティに継承フレームワークを提供します。これらの 2 つの階層は、Appearance および UltraGridOverride オブジェクトの 2 つのオブジェクトから実装されます。これらのオブジェクトの両方は「フォーマッタ」としての役割を果たします。希望する外観または動作を作るために他のオブジェクトに適用されるプロパティのコレクションを提供します。たとえば、UltraGridBand オブジェクトは Override サブオブジェクトを持ちます。値を継承できるすべての UltraGridBand プロパティは、UltraGridBand の UltraGridOverride オブジェクトのプロパティとして存在し、UltraGridBand オブジェクト自体のプロパティとして直接表示されません。

UltraGridOverride オブジェクトの 2 つのタイプがあります。基本 UltraGridOverride オブジェクトは他のオブジェクトに組み込まれます。オブジェクトに関連する Override プロパティが含まれます。コントロールの Overrides コレクションに表示されません。UltraGridOverride の他のタイプは、Overrides コレクションの Add メソッドを起動することによって作成できるスタンドアローン オブジェクトです。スタンドアローン UltraGridOverride のプロパティの設定は、スタンドアローン オブジェクトが基本 UltraGridOverride オブジェクトのひとつに適用されるまでグリッドに効果がありません。スタンドアローン Overrides は属性のグループを作成するための簡単な方法をユーザーに提供し、それらを必要に応じてオブジェクトに適用します。

UltraGridOverride オブジェクトのプロパティを変更するとき、そのオブジェクトがサポートするすべてのプロパティの値を指定する必要はありません。UltraGridOverride オブジェクトが、ゼロから新規に作成したスタンドアローン オブジェクトであるか、またはすでに他のオブジェクトに関連付けられている組み込みオブジェクトであるかにかかわらず、ある特定のプロパティのみを設定し、それ以外のプロパティを無視することが可能です。明示的に設定していないオブジェクトには、そのプロパティに特定の設定がないことを示す "use default" 値が与えられます。

"use default" 値に設定されたプロパティは、オーバーライドの階層に従って他のオブジェクトから設定を継承します。オーバーライド階層内の各オブジェクトは、"use default" 値の代わりに実際に使用する数値を継承するための親オブジェクトを持っています。"use default"値をプロパティの初期設定と混同しないでください。 プロパティの初期設定は通常"デフォルト値"と呼びます。多くの場合、オブジェクトのプロパティのデフォルト設定は"use default"です。 これは、そのプロパティが初期状態では特定の値を使用するように設定されていないことを意味します。"use default" 値は、列挙プロパティ(通常は "default" で終わる定数で示されます。HeaderClickActionDefault など)では 0、サイズおよび位置に関連するプロパティによって使用される数値設定(色関連プロパティで使用される設定など)では -1(0xFFFFFFFF)です。

たとえば、最上位レベル バンドの UltraGridOverride オブジェクトは 0(HeaderClickActionDefault)に設定されている HeaderClickAction プロパティがある場合、グリッドはオーバーライド階層の最上位レベル バンドの上であるのでコントロールはバンドでグリッドの HeaderClickAction プロパティの設定を使用します。オーバーライド階層の最上位レベルは、UltraWinGrid コントロール自体です。UltraWinGrid の UltraGridOverride オブジェクトのいずれかのプロパティが "use default" 値に設定されている場合、コントロールはそのプロパティの組み込みの値("ファクトリ プリセット")を使用します。たとえば、グリッドの UltraGridOverride オブジェクトの HeaderClickAction プロパティのファクトリ プリセットは、列を選択するために使用される列ヘッダーを作る値です: 1 (HeaderClickActionSelect)。1 (HeaderClickActionSelect).これは、グリッドの Override オブジェクトの HeaderClickAction プロパティが "use default" 値に設定されている場合、グリッドの列ヘッダーがどのように動作するかを決定するために使用される値です。

使用例
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

      ' Enable row filtering on the first band only and set the RowFilterMode to
      ' AllRowInBand which dictates that the UltraGrid use UltraGridBand.ColumnFilters 
      ' rather than RowsCollection.ColumnFilters.
      e.Layout.Bands(0).Override.AllowRowFiltering = DefaultableBoolean.True
      e.Layout.Bands(0).Override.RowFilterMode = RowFilterMode.AllRowsInBand

      ' Set the AllowRowSummaries to either True or BasedOnDataType to allow
      ' the user to be able to add, remove or modify summaries. This is not 
      ' necessary to create summaries programmatically and only effects the 
      ' users ability to create, remove or modify summaries.
      e.Layout.Bands(2).Override.AllowRowSummaries = AllowRowSummaries.BasedOnDataType

      ' You can also prevent the user from adding, removing or modifying a
      ' summary on a column basis. This prevents the user from summarizing OrderID 
      ' and ProductID columns.
      e.Layout.Bands(2).Columns("OrderID").AllowRowSummaries = AllowRowSummaries.False
      e.Layout.Bands(2).Columns("ProductID").AllowRowSummaries = AllowRowSummaries.False

      ' Set the HeaderClickAction to SortMulti to allow the user to sort 
      ' columns by clickin on the column headers.
      e.Layout.Override.HeaderClickAction = HeaderClickAction.SortMulti

      ' Set various appearances using Override. Override off the DisplayLayout sets 
      ' grid-wide appearances while Override off individual bands sets the appearances
      ' for that particular band.
      e.Layout.Override.CellAppearance.BackColor = Color.LightCyan

      ' You can override these for a specific band, in this case band 2.
      e.Layout.Bands(2).Override.CellAppearance.BackColor = Color.Beige

      ' You can also override appearance for individual columns.
      e.Layout.Bands(0).Columns("CustomerID").CellAppearance.ForeColor = Color.Gray

      ' Set the CustomerID column's VisiblePosition to 0 so it's the first column
      ' on the display.
      e.Layout.Bands(0).Columns("CustomerID").Header.VisiblePosition = 0

  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)
{	
		
	// Enable row filtering on the first band only and set the RowFilterMode to
	// AllRowInBand which dictates that the UltraGrid use UltraGridBand.ColumnFilters 
	// rather than RowsCollection.ColumnFilters.
	e.Layout.Bands[0].Override.AllowRowFiltering = DefaultableBoolean.True;
	e.Layout.Bands[0].Override.RowFilterMode = RowFilterMode.AllRowsInBand;

	// Set the AllowRowSummaries to either True or BasedOnDataType to allow
	// the user to be able to add, remove or modify summaries. This is not 
	// necessary to create summaries programmatically and only effects the 
	// users ability to create, remove or modify summaries.
	e.Layout.Bands[2].Override.AllowRowSummaries = AllowRowSummaries.BasedOnDataType;

	// You can also prevent the user from adding, removing or modifying a
	// summary on a column basis. This prevents the user from summarizing OrderID 
	// and ProductID columns.
	e.Layout.Bands[2].Columns["OrderID"].AllowRowSummaries = AllowRowSummaries.False;
	e.Layout.Bands[2].Columns["ProductID"].AllowRowSummaries = AllowRowSummaries.False;

	// Set the HeaderClickAction to SortMulti to allow the user to sort 
	// columns by clickin on the column headers.
	e.Layout.Override.HeaderClickAction = HeaderClickAction.SortMulti;

	// Set various appearances using Override. Override off the DisplayLayout sets 
	// grid-wide appearances while Override off individual bands sets the appearances
	// for that particular band.
	e.Layout.Override.CellAppearance.BackColor = Color.LightCyan;

	// You can override these for a specific band, in this case band 2.
	e.Layout.Bands[2].Override.CellAppearance.BackColor = Color.Beige;

	// You can also override appearance for individual columns.
	e.Layout.Bands[0].Columns["CustomerID"].CellAppearance.ForeColor = Color.Gray;

	// Set the CustomerID column's VisiblePosition to 0 so it's the first column
	// on the display.
	e.Layout.Bands[0].Columns["CustomerID"].Header.VisiblePosition = 0;

}
参照