Version

Appearance Property (UltraDateTimeEditor)

Returns or sets the Infragistics.Win.AppearanceBase object that controls the objects'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 of the objects in the UltraWinSchedule, 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 SSAppearance object to other objects. One way is to create a new Appearance object, adding it directly to the Appearances collection. 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:

UltraDateTimeEditor1.Appearances.Add "New1"

UltraDateTimeEditor1.Appearances("New1").BorderColor = Color.Blue

UltraDateTimeEditor1.Appearances("New1").ForeColor = Color.Red

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:

UltraDateTimeEditor1.Appearance = UltraDateTimeEditor1.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:

UltraDateTimeEditor1.Appearance.ForeColor = Color.Blue

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...

UltraDateTimeEditor1.Appearance.ForeColor = UltraDateTimeEditor1.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 control, you would use the following code:

UltraDateTimeEditor1.Appearance = UltraDateTimeEditor1.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 control hierarchy is inherited by objects lower in the hierarchy.

Example
This example sets the various appearances of the UltraWinEditors controls so that they have a light blue gradient background, and a dark blue foreground.

Imports Infragistics.Win
Imports Infragistics.Win.UltraWinEditors

    Private Sub SetupAppearance()
        '	Create a new Appearance object
        Dim appearance As Infragistics.Win.Appearance = New Infragistics.Win.Appearance()

        '	Set some of the color properties of the Appearance object
        appearance.BackColor = Color.White
        appearance.BackColor2 = Color.LightBlue
        appearance.ForeColor = Color.DarkBlue

        '	Set the background gradient style
        appearance.BackGradientStyle = GradientStyle.ForwardDiagonal

        '	Set the AlwaysInEditMode property to false so gradient drawing
        '	will be enabled when the control does not have the input focus
        '
        '	Note that this only applies to the controls that use a TextBox for
        '	their edit portion (UltraTextEditor, UltraComboEditor, and UltraFontNameEditor)
        Me.ultraTextEditor1.AlwaysInEditMode = False
        Me.ultraComboEditor1.AlwaysInEditMode = False
        Me.ultraFontNameEditor1.AlwaysInEditMode = False

        '	Set each UltraWinEditor control's Appearance property to the
        '	Appearance object we just created, so they all have the same
        '	appearance
        Me.ultraTextEditor1.Appearance = appearance
        Me.ultraComboEditor1.Appearance = appearance
        Me.ultraFontNameEditor1.Appearance = appearance
        Me.ultraDateTimeEditor1.Appearance = appearance
        Me.ultraNumericEditor1.Appearance = appearance
        Me.ultraCurrencyEditor1.Appearance = appearance

        '	Create another Appearance object that we will assign to the
        '	ButtonAppearance property of the relevant controls
        Dim buttonAppearance As Infragistics.Win.Appearance = New Infragistics.Win.Appearance()
        buttonAppearance.BackColor = Color.AliceBlue
        buttonAppearance.BackColorDisabled = Color.AliceBlue
        buttonAppearance.ForeColor = Color.DarkBlue

        '	Set the ButtonAppearance of the relevant controls
        '	For the UltraComboEditor and UltraFontNameEditor, this appearance
        '	will be applied to their dropdown buttons. For the UltraNumericEditor
        '	and UltraCurrencyEditor, it will be applied to the spin buttons, and
        '	for the UltraDateTimeEditor, it will be applied to both.
        Me.ultraComboEditor1.ButtonAppearance = buttonAppearance
        Me.ultraFontNameEditor1.ButtonAppearance = buttonAppearance
        Me.ultraDateTimeEditor1.ButtonAppearance = buttonAppearance
        Me.ultraNumericEditor1.ButtonAppearance = buttonAppearance
        Me.ultraCurrencyEditor1.ButtonAppearance = buttonAppearance

        '	If the UltraComboEditor control has no items, add some now
        If (Me.UltraComboEditor1.Items.Count = 0) Then
            Me.UltraComboEditor1.Items.Add(1, "One")
            Me.UltraComboEditor1.Items.Add(2, "Two")
            Me.UltraComboEditor1.Items.Add(3, "Three")
        End If

        '	Set the ItemAppearance of the relevant controls to use the
        '	ButtonAppearance
        Me.UltraComboEditor1.ItemAppearance = Me.UltraComboEditor1.ButtonAppearance
        Me.UltraFontNameEditor1.ItemAppearance = Me.UltraFontNameEditor1.ButtonAppearance

        '	Set their ButtonStyle properties as well
        Me.UltraComboEditor1.ButtonStyle = UIElementButtonStyle.ButtonSoft
        Me.UltraFontNameEditor1.ButtonStyle = UIElementButtonStyle.ButtonSoft
        Me.UltraDateTimeEditor1.ButtonStyle = UIElementButtonStyle.ButtonSoft
        Me.UltraNumericEditor1.ButtonStyle = UIElementButtonStyle.ButtonSoft
        Me.UltraCurrencyEditor1.ButtonStyle = UIElementButtonStyle.ButtonSoft

        '	Make the spin buttons visible for the relevant controls
        Me.UltraDateTimeEditor1.SpinButtonDisplayStyle = ButtonDisplayStyle.Always
        Me.UltraNumericEditor1.SpinButtonDisplayStyle = ButtonDisplayStyle.Always
        Me.UltraCurrencyEditor1.SpinButtonDisplayStyle = ButtonDisplayStyle.Always
    End Sub
using System.Diagnostics;
using Infragistics.Win;
using Infragistics.Win.UltraWinEditors;

		private void SetupAppearance()
		{
			//	Create a new Appearance object
			Infragistics.Win.Appearance appearance = new Infragistics.Win.Appearance();
			
			//	Set some of the color properties of the Appearance object
			appearance.BackColor = Color.White;
			appearance.BackColor2 = Color.LightBlue;
			appearance.ForeColor = Color.DarkBlue;

			//	Set the background gradient style
			appearance.BackGradientStyle = GradientStyle.ForwardDiagonal;

			//	Set the AlwaysInEditMode property to false so gradient drawing
			//	will be enabled when the control does not have the input focus
			//
			//	Note that this only applies to the controls that use a TextBox for
			//	their edit portion (UltraTextEditor, UltraComboEditor, and UltraFontNameEditor)
			this.ultraTextEditor1.AlwaysInEditMode = false;
			this.ultraComboEditor1.AlwaysInEditMode = false;
			this.ultraFontNameEditor1.AlwaysInEditMode = false;

			//	Set each UltraWinEditor control's Appearance property to the
			//	Appearance object we just created, so they all have the same
			//	appearance
			this.ultraTextEditor1.Appearance = appearance;
			this.ultraComboEditor1.Appearance = appearance;
			this.ultraFontNameEditor1.Appearance = appearance;
			this.ultraDateTimeEditor1.Appearance = appearance;
			this.ultraNumericEditor1.Appearance = appearance;
			this.ultraCurrencyEditor1.Appearance = appearance;

			//	Create another Appearance object that we will assign to the
			//	ButtonAppearance property of the relevant controls
			Infragistics.Win.Appearance buttonAppearance = new Infragistics.Win.Appearance();
			buttonAppearance.BackColor = Color.AliceBlue;
			buttonAppearance.BackColorDisabled = Color.AliceBlue;
			buttonAppearance.ForeColor = Color.DarkBlue;

			//	Set the ButtonAppearance of the relevant controls
			//	For the UltraComboEditor and UltraFontNameEditor, this appearance
			//	will be applied to their dropdown buttons. For the UltraNumericEditor
			//	and UltraCurrencyEditor, it will be applied to the spin buttons, and
			//	for the UltraDateTimeEditor, it will be applied to both.
			this.ultraComboEditor1.ButtonAppearance = buttonAppearance;
			this.ultraFontNameEditor1.ButtonAppearance = buttonAppearance;
			this.ultraDateTimeEditor1.ButtonAppearance = buttonAppearance;
			this.ultraNumericEditor1.ButtonAppearance = buttonAppearance;
			this.ultraCurrencyEditor1.ButtonAppearance = buttonAppearance;

			//	If the UltraComboEditor control has no items, add some now
			if ( this.ultraComboEditor1.Items.Count == 0 )
			{
				this.ultraComboEditor1.Items.Add( 1, "One" );
				this.ultraComboEditor1.Items.Add( 2, "Two" );
				this.ultraComboEditor1.Items.Add( 3, "Three" );
			}

			//	Set the ItemAppearance of the relevant controls to use the
			//	ButtonAppearance
			this.ultraComboEditor1.ItemAppearance = this.ultraComboEditor1.ButtonAppearance;
			this.ultraFontNameEditor1.ItemAppearance = this.ultraFontNameEditor1.ButtonAppearance;

			//	Set their ButtonStyle properties as well
			this.ultraComboEditor1.ButtonStyle = UIElementButtonStyle.ButtonSoft;
			this.ultraFontNameEditor1.ButtonStyle = UIElementButtonStyle.ButtonSoft;
			this.ultraDateTimeEditor1.ButtonStyle = UIElementButtonStyle.ButtonSoft;
			this.ultraNumericEditor1.ButtonStyle = UIElementButtonStyle.ButtonSoft;
			this.ultraCurrencyEditor1.ButtonStyle = UIElementButtonStyle.ButtonSoft;

			//	Make the spin buttons visible for the relevant controls
			this.ultraDateTimeEditor1.SpinButtonDisplayStyle = ButtonDisplayStyle.Always;
			this.ultraNumericEditor1.SpinButtonDisplayStyle = ButtonDisplayStyle.Always;
			this.ultraCurrencyEditor1.SpinButtonDisplayStyle = ButtonDisplayStyle.Always;
		}
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