Version

CellAppearance Property (UltraGridRow)

Determines the formatting attributes that will be applied to the cells in a row.
Syntax
'Declaration
 
Public Property CellAppearance As Infragistics.Win.Appearance
public Infragistics.Win.Appearance CellAppearance {get; set;}
Remarks

The CellAppearance property is used to specify the appearance of all the cells in a row. When you assign an Appearance object to the CellAppearance property, the properties of that object will be applied to all the cells belonging to the row. You can use the CellAppearance property to examine or change any of the appearance-related properties that are currently assigned to the cells, for example:

UltraWinGrid1.Override.CellAppearance.BackColor = vbYellow

You can override the CellAppearance setting for specific cells by setting the Appearance property of the UltraGridCell object directly. The cell will always use the values of its own Appearance object before it will use the values inherited from the Appearance object specified by the CellAppearance property of the row or band it occupies.

If any of the properties of the Appearance object specified for the CellAppearance property are set to default values, the properties from the Appearance object of the row containing the cell are used.

Example
Following code sets CellAppearance on various objects in the UltraGrid. It illustrates how the resolution hierarchy works in the UltraGrid. Basically properties not set on an object get inherited from a higher level object. Highest level object is the Layout and its override. Then is the band and its override then is the column, row and cell in order.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid

  Private Sub Button9_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button9.Click

      ' Get the layout, a band, a column, a row and a cell for the demonstration purpose.
      Dim layout As UltraGridLayout = Me.ultraGrid1.DisplayLayout
      Dim band As UltraGridBand = layout.Bands(0)
      Dim column As UltraGridColumn = band.Columns(0)
      Dim row As UltraGridRow = Me.ultraGrid1.Rows(0)
      Dim cell As UltraGridCell = row.Cells(column)

      ' The way the UltraGrid resolves cell appearance is that objects at a lower level
      ' in the object model hierarchy have higher precedence than objects in higher level.
      ' For example, a cell has a higher precedence than its row. A row has a higher
      ' precedence than a column. The precedence order usually is cell, row, column, band,
      ' layout in decresing precedence order.

      ' Set grid-wide cell appearance by using the layout's Override.
      layout.Override.CellAppearance.BackColor = Color.Yellow

      ' You can override above settings for a a band by setting the 
      ' Override.CellAppearance on the band. This will have higher precedence than
      ' the layout.Override.
      band.Override.CellAppearance.BackColor = Color.Magenta

      ' You can override cell appearance on a column as well so cell-appearance settings
      ' on both the band and the layout will be ignored.
      column.CellAppearance.BackColor = Color.Red

      ' In the same manner, you can override cell-apperance for a row.
      row.CellAppearance.BackColor = Color.Green

      ' You can override the cell-appearance for individual cells.
      cell.Appearance.BackColor = Color.Blue

  End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void button9_Click(object sender, System.EventArgs e)
{

	// Get the layout, a band, a column, a row and a cell for the demonstration purpose.
	UltraGridLayout layout = this.ultraGrid1.DisplayLayout;
	UltraGridBand   band   = layout.Bands[0];
	UltraGridColumn column = band.Columns[0];
	UltraGridRow    row    = this.ultraGrid1.Rows[0];
	UltraGridCell    cell   = row.Cells[column];

	// The way the UltraGrid resolves cell appearance is that objects at a lower level
	// in the object model hierarchy have higher precedence than objects in higher level.
	// For example, a cell has a higher precedence than its row. A row has a higher
	// precedence than a column. The precedence order usually is cell, row, column, band,
	// layout in decresing precedence order.

	// Set grid-wide cell appearance by using the layout's Override.
	layout.Override.CellAppearance.BackColor = Color.Yellow;

	// You can override above settings for a a band by setting the 
	// Override.CellAppearance on the band. This will have higher precedence than
	// the layout.Override.
	band.Override.CellAppearance.BackColor = Color.Magenta;

	// You can override cell appearance on a column as well so cell-appearance settings
	// on both the band and the layout will be ignored.
	column.CellAppearance.BackColor = Color.Red;

	// In the same manner, you can override cell-apperance for a row.
	row.CellAppearance.BackColor = Color.Green;

	// You can override the cell-appearance for individual cells.
	cell.Appearance.BackColor = Color.Blue;

}
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