Version

Override Property (UltraGridLayout)

The UltraGridOverride object is used to determine the behavior of bands in the grid. Applying an UltraGridOverride to an object replaces that object's default behavior with the behavior specified by the settings of the UltraGridOverride. The DisplayLayout object has an Override property setting that determines the default settings for all UltraGridBands. The UltraGridBand object also has an Override property for settings specific to that band.
Syntax
'Declaration
 
Public Property Override As UltraGridOverride
public UltraGridOverride Override {get; set;}
Remarks

Because the UltraWinGrid was designed primarily to work with hierarchical data, hierarchical concepts are built into the control at many levels. One of the fundamental design attributes of the Grid is that the objects that make up the control exist in hierarchies, and are influenced by the other objects in a hierarchical fashion. Through the concept of inheritance, objects in the Grid can derive the settings of their properties from the settings of objects that exist above them in a given hierarchy.

Two of the main hierarchies you will encounter in the UltraWinGrid are the Appearance hierarchy and the Override hierarchy. The Appearance hierarchy provides a way for Grid objects to inherit the settings of the properties that affect the object's appearance, such as properties related to color, font and transparency. The Override hierarchy provides the inheritance framework for other properties of the grid that are not necessarily related to appearance. These two hierarchies are implemented through two objects: the Appearance object and the UltraGridOverride object. Both of these objects serve as "formatters" - they offer collections of properties that are applied to other objects in order to produce a desired appearance or behavior. For example, the UltraGridBand object has an Override sub-object. All of the UltraGridBand's properties that can inherit their values exist as properties of the UltraGridBand's UltraGridOverride object; they do not appear directly as properties of the UltraGridBand object itself.

You will encounter two types of UltraGridOverride objects. Intrinsic UltraGridOverride objects are built in to other objects. They contain the Override properties associated with that object. They do not appear in the control's Overrides collection. The other type of UltraGridOverride is the stand-alone object that you can create by invoking the Add method of the Overrides collection. The settings of a stand-alone UltraGridOverride's properties do not have any effect on the Grid until the stand-alone object is applied to one of the intrinsic UltraGridOverride objects. Stand-alone Overrides give you an easy way to create groups of attributes and apply them to objects as needed.

When you change the properties of an UltraGridOverride object, you are not required to specify a value for every property that object supports. Whether the UltraGridOverride object is a stand-alone object you are creating from scratch, or an intrinsic object that is already attached to some other object, you can set certain properties and ignore others. The properties you do not explicitly set are given a "use default" value that indicates there is no specific setting for that property.

Properties that are set to the "use default" value derive their settings from other objects by following an override hierarchy. In the override hierarchy, each object has a parent object from which it can inherit the actual numeric values to use in place of the "use default" values. The "use default" value should not be confused with the initial setting of the property, which is generally referred to as the default value. In many cases, the default setting of an object's property will be "use default"; this means that the property is initially set not to use a specific value. The "use default" value will be 0 for an enumerated property (usually indicated by a constant ending in the word "default," such as HeaderClickActionDefault) or -1 (0xFFFFFFFF) for a numeric setting, such as that used by size and position-related properties.

So for example, if the UltraGridOverride object of the top-level band has its HeaderClickAction property set to 0 (HeaderClickActionDefault), the control will use the setting of the grid's HeaderClickAction property for the band, because the grid is above the top-level band in the override hierarchy. The top-most level of the override hierarchy is the UltraWinGrid control itself. If any of the UltraWinGrid's UltraGridOverride object properties are set to their "use default" values, the control uses built-in values (the "factory presets") for those properties. For example, the factory preset of the HeaderClickAction property of the grid's UltraGridOverride object is the value that causes the column headers to be used for selecting columns: 1 (HeaderClickActionSelect). This is the value that will be used to determine how column headers in the grid will behave when the HeaderClickAction property of the grid's Override object is set to the "use default" value.

Example
InitializeLayout event is a good place to initialize the grid. Following code sets some of the commonly used properties on the grid.

For an overview of how to handle events in Visual Basic or Visual C#, see Event Handlers in Visual Basic and Visual C#. For specific information and code examples illustrating how to consume events in your application, see Consuming Events in the .NET Framework Developer's Guide.

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;

}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also