'Declaration Public Overloads Overridable Sub ResolveAppearance( _ ByRef appData As Infragistics.Win.AppearanceData, _ ByVal requestedProps As Infragistics.Win.AppearancePropFlags _ )
public virtual void ResolveAppearance( ref Infragistics.Win.AppearanceData appData, Infragistics.Win.AppearancePropFlags requestedProps )
Examining the value of the Appearance property that has not been set will return the "use default" value, not the internal value that is actually being used to display the object affected by the Appearance object. In order to find out what values are being used, you must use the ResolveAppearance method. This method initializes the specified AppearanceData structur with values that can be used to determine how the object will look.
When you change the properties of an Appearance object, you are not required to specify a value for every property that object supports. Whether the Appearance 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 appearance hierarchy. In the appearance 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 AlignDefault) or -1 (0xFFFFFFFF) for a numeric setting, such as that used by color-related properties.
So for example, if the Appearance object of a cell has its BackColor property set to -1, the control will use the setting of the row's BackColor property for the cell, because the row is above the cell in the appearance hierarchy. The top level of the appearance hierarchy is the UltraGrid control itself. If any of the UltraWinGrid's Appearance 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 BackColor property of the grid's Appearance object is the system button face color (0x8000000F). This is the value that will be used for the grid's background color when the BackColor property of the grid's Appearance object is set to the "use default" value.
The ResolveAppearance method will initialize the specified AppearanceData structure with all of its "use default" settings converted into actual values. It does this by navigating the appearance hierarchy for each property until an explicit setting or a factory preset is encountered. If you simply place a grid on a form, run the project, and examine the setting of the BackColor property of the grid's intrinsic Appearance object:
MsgBox Hex(UltraWinGrid1.Rows(0).Appearance.BackColor)
...you will see that it is set to the "use default" value (0xFFFFFFFF). However, if you use the ResolveAppearance method to display the same value:
Dim appData as AppearanceData = new AppearanceData()
UltraWinGrid1.Rows(0).ResolveAppearance(ByRef appData)
MsgBox Hex(appData.BackColor)
...you will see that it is set to the system button face color (0x8000000F).
Imports Infragistics.Win Imports Infragistics.Win.UltraWinGrid Imports System.Diagnostics Private Sub button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button4.Click Dim appData As AppearanceData Dim requestedProps As AppearancePropFlags Dim cell As UltraGridCell Dim row As UltraGridRow ' ----------------------------------------- ' Resolve the appearance of the active cell ' ----------------------------------------- ' Get the active cell cell = Me.ultraGrid1.ActiveCell If cell Is Nothing Then Return ' Initialize the appearance data structure appData = New AppearanceData() ' Specify which appearance properties we want to resolve. ' In this case just the backcolor and forecolor. requestedProps = AppearancePropFlags.BackColor Or AppearancePropFlags.ForeColor ' Call the cell's 'ResolveAppearance' method. cell.ResolveAppearance(appData, requestedProps) ' Write out the resolved colors Debug.WriteLine("BackColor: " + appData.BackColor.ToString() + ", ForeColor: " + appData.ForeColor.ToString()) ' ------------------------------------------------ ' Resolve the appearance of the cell's row ' ------------------------------------------------ ' get the cell's row row = cell.Row ' Re-initialize the appearance data structure appData = New AppearanceData() ' Specify which appearance properties we want to resolve. ' In this case we want all 'Render' properties. This ' includes every property but the 'Cursor' property. requestedProps = AppearancePropFlags.AllRender ' Call the row's 'ResolveAppearance' method. ' The third parameter indicates whether resolve the ' apperance of the preview area or not. row.ResolveAppearance(appData, requestedProps, False) ' Write out the resolved gradient related properties. Debug.WriteLine("BackGradientStyle: " + appData.BackGradientStyle.ToString() + ", BackColor: " + appData.BackColor.ToString() + ", BackColor2: " + appData.BackColor2.ToString()) ' Calling the row's 'ResolveCellAppearance' method is ' functionally equivalent to calling the cell's ' 'ResolveAppearance' method. 'row.ResolveCellAppearance(cell.Column, appData, requestedProps) ' There is also a 'ResolveRowSelectorAppearance' method ' exposed off the row. 'row.ResolveRowSelectorAppearance(appData, requestedProps) ' The header object exposed off bands, columns and groups ' also exposes a 'ResolveRowSelectorAppearance' method. 'cell.Column.Header.ResolveAppearance(appData, requestedProps) ' The AddNewBox also exposes 'Resolve...' methods. 'Me.ultraGrid1.DisplayLayout.AddNewBox.ResolveAppearance(appData, requestedProps) 'Me.ultraGrid1.DisplayLayout.AddNewBox.ResolveButtonAppearance(appData, requestedProps) ' The GroupByBox also exposes 'Resolve...' methods. 'Me.ultraGrid1.DisplayLayout.GroupByBox.ResolveAppearance(appData, requestedProps) 'Me.ultraGrid1.DisplayLayout.GroupByBox.ResolveBandLabelAppearance(appData, requestedProps) 'Me.ultraGrid1.DisplayLayout.GroupByBox.ResolvePromptAppearance(appData, requestedProps) End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; private void button4_Click(object sender, System.EventArgs e) { AppearanceData appData; AppearancePropFlags requestedProps; UltraGridCell cell; UltraGridRow row; // ----------------------------------------- // Resolve the appearance of the active cell // ----------------------------------------- // Get the active cell cell = this.ultraGrid1.ActiveCell; if ( cell == null ) return; // Initialize the appearance data structure appData = new AppearanceData(); // Specify which appearance properties we want to resolve. // In this case just the backcolor and forecolor. requestedProps = AppearancePropFlags.BackColor | AppearancePropFlags.ForeColor; // Call the cell's 'ResolveAppearance' method. cell.ResolveAppearance( ref appData, requestedProps ); // Write out the resolved colors Debug.WriteLine("BackColor: " + appData.BackColor.ToString() + ", ForeColor: " + appData.ForeColor.ToString() ); // ------------------------------------------------ // Resolve the appearance of the cell's row // ------------------------------------------------ // get the cell's row row = cell.Row; // Re-initialize the appearance data structure appData = new AppearanceData(); // Specify which appearance properties we want to resolve. // In this case we want all 'Render' properties. This // includes every property but the 'Cursor' property. requestedProps = AppearancePropFlags.AllRender; // Call the row's 'ResolveAppearance' method. // The third parameter indicates whether resolve the // apperance of the preview area or not. row.ResolveAppearance( ref appData, requestedProps, false ); // Write out the resolved gradient related properties. Debug.WriteLine("BackGradientStyle: " + appData.BackGradientStyle.ToString() + ", BackColor: " + appData.BackColor.ToString() + ", BackColor2: " + appData.BackColor2.ToString() ); // Calling the row's 'ResolveCellAppearance' method is // functionally equivalent to calling the cell's // 'ResolveAppearance' method. //row.ResolveCellAppearance( cell.Column, ref appData, requestedProps ); // There is also a 'ResolveRowSelectorAppearance' method // exposed off the row. //row.ResolveRowSelectorAppearance( ref appData, requestedProps ); // The header object exposed off bands, columns and groups // also exposes a 'ResolveRowSelectorAppearance' method. //cell.Column.Header.ResolveAppearance( ref appData, requestedProps ); // The AddNewBox also exposes 'Resolve...' methods. //this.ultraGrid1.DisplayLayout.AddNewBox.ResolveAppearance(ref appData, requestedProps ); //this.ultraGrid1.DisplayLayout.AddNewBox.ResolveButtonAppearance(ref appData, requestedProps ); // The GroupByBox also exposes 'Resolve...' methods. //this.ultraGrid1.DisplayLayout.GroupByBox.ResolveAppearance(ref appData, requestedProps ); //this.ultraGrid1.DisplayLayout.GroupByBox.ResolveBandLabelAppearance(ref appData, requestedProps ); //this.ultraGrid1.DisplayLayout.GroupByBox.ResolvePromptAppearance(ref appData, requestedProps ); }
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