Version

Appearance Property (UltraGridLayout)

Returns or sets the Appearance object that controls the object's formatting.
Syntax
'Declaration
 
Public Property Appearance As Infragistics.Win.AppearanceBase
public Infragistics.Win.AppearanceBase Appearance {get; set;}
Remarks

The Appearance property of an object is used to associate the object with an Appearance object that will determine its appearance. The Appearance object has properties that control settings such as color, borders, font, transparency, etc. For many objects, you do not set formatting properties directly. Instead, you set the properties of an Appearance object, which controls the formatting of the object it is attached to.

There are two ways of working with the Appearance property and assigning the attributes of an Appearance object to other objects. One way is to create a new Appearance object, adding it directly to the Appearances collection. (Both the Appearance object and the Appearances collection are parts of the control's persistable layout and are therefore located in the UltraGridBase.DisplayLayout object.) Then you assign the new Appearance object to the Appearance property of the object you want to format. This method uses a "named" Appearance object that you must explicitly create (and to which you must assign property settings) before it can be used. For instance, you could create an object in the control's Appearances collection and assign it some values as follows:

UltraWinGrid1.DisplayLayout.Appearances.Add "New1"

UltraWinGrid1.DisplayLayout.Appearances("New1").BorderColor = vbBlue

UltraWinGrid1.DisplayLayout.Appearances("New1").ForeColor = vbRed

Creating the object in this way does not apply formatting to any visible part of the control. The object simply exists in the collection with its property values, waiting to be used. To actually use the object, you must assign it to the control's (or another object's) Appearance property:

UltraWinGrid1.DisplayLayout.Appearance = UltraWinGrid1.DisplayLayout.Appearances("New1")

In this case, only one Appearance object exists. The control's appearance is governed by the settings of the "New1" object in the collection. Any changes you make to the object in the collection will immediately be reflected in the control.

The second way of working with the Appearance property is to use it to set property values directly, such as:

UltraWinGrid1.DisplayLayout.Appearance.ForeColor = vbBlue

In this case, an Appearance object is automatically created by the control. This Appearance object is not a member of an Appearances collection and it does not have a name. It is specific to the object for which it was created; it is an "intrinsic" Appearance object. Changes to the properties of an intrinsic Appearance object are reflected only in the object to which it is attached.

Note that you can assign properties from a named Appearance object to an intrinsic Appearance object without creating a dependency relationship. For example, the following code...

UltraWinGrid1.DisplayLayout.Appearance.ForeColor = UltraWinGrid1.DisplayLayout.Appearances("New1").ForeColor

...does not establish a relationship between the foreground color of the intrinsic object and that of the named object. It is simply a one-time assignment of the named object's value to that of the intrinsic object. In this case, two Appearance objects exist - one in the collection and one attached to the control - and they operate independently of one another.

If you wish to assign all the properties of a named object to an intrinsic object at once without creating a dependency relationship, you can use the Clone method of the Appearance object to duplicate its settings and apply them. So if you wanted to apply all the property settings of the named Appearance object "New1" to the control's intrinsic Appearance object, but you did not want changes made to "New1" automatically reflected in the grid, you would use the following code:

UltraWinGrid1.DisplayLayout.Appearance = UltraWinGrid1.DisplayLayout.Appearances("New1").Clone

Note that the properties of an Appearance object can also operate in a hierarchical fashion. Certain properties can be set to a "use default" value, which indicates to the control that the property should take its setting from the object's parent. This functionality is enabled by default, so that unless you specify otherwise, child objects resemble their parents, and formatting set at higher levels of the grid hierarchy is inherited by objects lower in the hierarchy.

Example
Following code sets some of the commonly used properties of the UltraGrid in the Form's Load event.

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

  Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load

      Me.OleDbDataAdapter1.Fill(Me.DataSet11)
      Me.OleDbDataAdapter2.Fill(Me.DataSet11)
      Me.OleDbDataAdapter3.Fill(Me.DataSet11)

      ' Set the data source and data member to bind the grid.
      Me.UltraGrid1.DataSource = Me.DataSet11
      Me.UltraGrid1.DataMember = ""

      ' Disable alpha-blending which may increase performance.
      Me.UltraGrid1.AlphaBlendEnabled = False

      ' Disable theme support in WinXP based systems.
      Me.UltraGrid1.SupportThemes = False

      ' Set the appearance of the UltraGrid.
      Me.UltraGrid1.DisplayLayout.Appearance.BackColor = Color.Gray

      ' Set the border style of the UltraGrid.
      Me.UltraGrid1.DisplayLayout.BorderStyle = UIElementBorderStyle.InsetSoft

      ' Set the text, appearance and border styles of the caption.
      Me.UltraGrid1.Text = "UltraGrid Caption"
      Me.UltraGrid1.DisplayLayout.CaptionAppearance.FontData.Bold = DefaultableBoolean.True
      Me.UltraGrid1.DisplayLayout.BorderStyleCaption = UIElementBorderStyle.RaisedSoft

      ' Set the update mode which dictates when the UltraGrid calls EndEdit
      ' on IEditableObject row objects.
      Me.UltraGrid1.UpdateMode = UpdateMode.OnRowChangeOrLostFocus

      ' Set the scroll style to Immediate so that the UltraGrid scrolls the rows as
      ' the vertical scroll bar thumb is dragged. Normally the UltraGrid defers the
      ' scrolling until the thumb is released and displays scroll tips instead.
      Me.UltraGrid1.DisplayLayout.ScrollStyle = ScrollStyle.Immediate

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

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

	this.oleDbDataAdapter1.Fill( this.dataSet11 );
	this.oleDbDataAdapter2.Fill( this.dataSet11 );
	this.oleDbDataAdapter3.Fill( this.dataSet11 );

	// Set the data source and data member to bind the grid.
	this.ultraGrid1.DataSource = this.dataSet11;
	this.ultraGrid1.DataMember = "";

	// Disable alpha-blending which may increase performance.
	this.ultraGrid1.AlphaBlendEnabled = false;

	// Disable theme support in WinXP based systems.
	this.ultraGrid1.SupportThemes = false;
	
	// Set the appearance of the UltraGrid.
	this.ultraGrid1.DisplayLayout.Appearance.BackColor = Color.Gray;

	// Set the border style of the UltraGrid.
	this.ultraGrid1.DisplayLayout.BorderStyle = UIElementBorderStyle.InsetSoft;			

	// Set the text, appearance and border styles of the caption.
	this.ultraGrid1.Text = "UltraGrid Caption";
	this.ultraGrid1.DisplayLayout.CaptionAppearance.FontData.Bold = DefaultableBoolean.True;
	this.ultraGrid1.DisplayLayout.BorderStyleCaption = UIElementBorderStyle.RaisedSoft;			
	
	// Set the update mode which dictates when the UltraGrid calls EndEdit
	// on IEditableObject row objects.
	this.ultraGrid1.UpdateMode = UpdateMode.OnRowChangeOrLostFocus;

	// Set the scroll style to Immediate so that the UltraGrid scrolls the rows as
	// the vertical scroll bar thumb is dragged. Normally the UltraGrid defers the
	// scrolling until the thumb is released and displays scroll tips instead.
	this.ultraGrid1.DisplayLayout.ScrollStyle = ScrollStyle.Immediate;

}
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