| Visual Basic (Declaration) | |
|---|---|
Public ReadOnly Property ActionButtonSettings As UltraNavigationBarActionButtonSettings | |
| C# | |
|---|---|
public UltraNavigationBarActionButtonSettings ActionButtonSettings {get;} | |
The following code sample demonstrates how to use the UltraNavigationBar's appearance model to customize the look of the control:
| Visual Basic | Copy Code |
|---|---|
Imports System Imports System.Drawing Imports System.IO Imports System.Collections.Generic Imports System.ComponentModel Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.AppStyling Imports Infragistics.Win.AppStyling.Runtime Imports Infragistics.Win.Misc Imports Infragistics.Win.Misc.UltraWinNavigationBar Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click ' Use known colors as the basis for the color scheme Dim backColor As Color = Color.Olive Dim backColorLight As Color = Color.White Dim foreColor As Color = Color.DarkOliveGreen ' Adjust the luminosity of the foreground Color to get the border color Dim borderColor As Color = Infragistics.Shared.XPItemColor.ColorFromHLS(foreColor.GetHue(), foreColor.GetBrightness() * 0.75F, foreColor.GetSaturation()) ' Set up the 'Normal' Appearance Dim normalAppearance As AppearanceBase = New Infragistics.Win.Appearance("Normal") normalAppearance.BackColor = Color.Transparent normalAppearance.BackGradientStyle = GradientStyle.None ' Set up the 'HotTrack' Appearance Dim hotTrackAppearance As AppearanceBase = New Infragistics.Win.Appearance("HotTrack") hotTrackAppearance.BackColor = backColorLight hotTrackAppearance.BackColor2 = BackColor hotTrackAppearance.BorderColor = borderColor hotTrackAppearance.ForeColor = ForeColor hotTrackAppearance.BackGradientStyle = GradientStyle.Vertical ' Set up the 'Pressed' Appearance Dim pressedAppearance As AppearanceBase = New Infragistics.Win.Appearance("Pressed") pressedAppearance.BackColor = BackColor pressedAppearance.BackColor2 = backColorLight pressedAppearance.BorderColor = ForeColor pressedAppearance.BorderColor2 = borderColor pressedAppearance.ForeColor = borderColor pressedAppearance.BackGradientStyle = GradientStyle.Vertical ' Set up the 'Selected' Appearance Dim selectedAppearance As AppearanceBase = New Infragistics.Win.Appearance("Selected") selectedAppearance.BackColor = Color.Transparent selectedAppearance.BorderColor = borderColor selectedAppearance.ForeColor = borderColor selectedAppearance.BackGradientStyle = GradientStyle.Vertical ' Set up the 'DropDownList' Appearance Dim dropDownListAppearance As AppearanceBase = New Infragistics.Win.Appearance("DropDownList") dropDownListAppearance.BackColor = Color.FromArgb(128, backColorLight) dropDownListAppearance.BackColor2 = Color.FromArgb(128, BackColor) dropDownListAppearance.BackGradientStyle = GradientStyle.ForwardDiagonal dropDownListAppearance.BorderColor = borderColor ' Assign the Appearances to the location appearances Me.ultraNavigationBar1.LocationSettings.Appearance = normalAppearance Me.ultraNavigationBar1.LocationSettings.ActiveAppearance = hotTrackAppearance Me.ultraNavigationBar1.LocationSettings.HotTrackAppearance = hotTrackAppearance Me.ultraNavigationBar1.LocationSettings.PressedAppearance = pressedAppearance Me.ultraNavigationBar1.LocationSettings.SelectedAppearance = selectedAppearance Me.ultraNavigationBar1.LocationSettings.LocationsDropDownListAppearance = dropDownListAppearance ' Set DrawsFocusRect to true to provide the end user with a visual cue ' when the control receives the input focus. Me.ultraNavigationBar1.DrawsFocusRect = DefaultableBoolean.True ' Assign the Appearances to the action button related appearances Me.ultraNavigationBar1.ActionButtonSettings.Appearance = normalAppearance Me.ultraNavigationBar1.ActionButtonSettings.HotTrackAppearance = hotTrackAppearance Me.ultraNavigationBar1.ActionButtonSettings.PressedAppearance = pressedAppearance ' Assign the Appearances to the previous locations related appearances Me.ultraNavigationBar1.PreviousLocationsSettings.DropDownButtonAppearance = normalAppearance Me.ultraNavigationBar1.PreviousLocationsSettings.DropDownButtonHotTrackAppearance = hotTrackAppearance Me.ultraNavigationBar1.PreviousLocationsSettings.DropDownButtonPressedAppearance = pressedAppearance Me.ultraNavigationBar1.PreviousLocationsSettings.DropDownListAppearance = dropDownListAppearance ' Set the control's ForeColor, which will be picked up by most elements Me.ultraNavigationBar1.Appearance.ForeColor = ForeColor Me.ultraNavigationBar1.HotTrackAppearance.ForeColor = ForeColor ' Use Application Styling to configure the appearance of the scrollbars Dim library As ApplicationStyleLibrary = New ApplicationStyleLibrary() Dim styleSet As StyleSetSettings = library.StyleSets.Add("Default") styleSet.UseFlatMode = DefaultableBoolean.True Dim styleSettings As StyleSettings = styleSet.RoleStyles.GetStyle(Infragistics.Win.AppStyling.UIRoleNames.ScrollBar, True) styleSettings.ButtonStyle = UIElementButtonStyle.PopupBorderless Dim scrollBarAppearance As AppearanceBase = styleSettings.States.GetState(RoleState.Normal, True).Appearance scrollBarAppearance.ThemedElementAlpha = Alpha.Transparent scrollBarAppearance.BackColor = Color.FromArgb(64, Color.Olive) scrollBarAppearance.ForeColor = Color.DarkOliveGreen scrollBarAppearance.BorderColor = Color.Olive library.UpdateStyleManager() ' Store the appearances in the control's Appearances collection for future reference Me.ultraNavigationBar1.Appearances.Add(normalAppearance) Me.ultraNavigationBar1.Appearances.Add(hotTrackAppearance) Me.ultraNavigationBar1.Appearances.Add(pressedAppearance) Me.ultraNavigationBar1.Appearances.Add(selectedAppearance) Me.ultraNavigationBar1.Appearances.Add(dropDownListAppearance) End Sub | |
| C# | Copy Code |
|---|---|
using System; using System.Drawing; using System.IO; using System.Collections.Generic; using System.ComponentModel; using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.AppStyling; using Infragistics.Win.AppStyling.Runtime; using Infragistics.Win.Misc; using Infragistics.Win.Misc.UltraWinNavigationBar; private void button1_Click(object sender, EventArgs e) { // Use known colors as the basis for the color scheme Color backColor = Color.Olive; Color backColorLight = Color.White; Color foreColor = Color.DarkOliveGreen; // Adjust the luminosity of the foreground Color to get the border color Color borderColor = Infragistics.Shared.XPItemColor.ColorFromHLS( foreColor.GetHue(), foreColor.GetBrightness() * .75f, foreColor.GetSaturation() ); // Set up the 'Normal' Appearance AppearanceBase normalAppearance = new Infragistics.Win.Appearance( "Normal" ); normalAppearance.BackColor = Color.Transparent; normalAppearance.BackGradientStyle = GradientStyle.None; // Set up the 'HotTrack' Appearance AppearanceBase hotTrackAppearance = new Infragistics.Win.Appearance( "HotTrack" ); hotTrackAppearance.BackColor = backColorLight; hotTrackAppearance.BackColor2 = backColor; hotTrackAppearance.BorderColor = borderColor; hotTrackAppearance.ForeColor = foreColor; hotTrackAppearance.BackGradientStyle = GradientStyle.Vertical; // Set up the 'Pressed' Appearance AppearanceBase pressedAppearance = new Infragistics.Win.Appearance( "Pressed" ); pressedAppearance.BackColor = backColor; pressedAppearance.BackColor2 = backColorLight; pressedAppearance.BorderColor = foreColor; pressedAppearance.BorderColor2 = borderColor; pressedAppearance.ForeColor = borderColor; pressedAppearance.BackGradientStyle = GradientStyle.Vertical; // Set up the 'Selected' Appearance AppearanceBase selectedAppearance = new Infragistics.Win.Appearance( "Selected" ); selectedAppearance.BackColor = Color.Transparent; selectedAppearance.BorderColor = borderColor; selectedAppearance.ForeColor = borderColor; selectedAppearance.BackGradientStyle = GradientStyle.Vertical; // Set up the 'DropDownList' Appearance AppearanceBase dropDownListAppearance = new Infragistics.Win.Appearance( "DropDownList" ); dropDownListAppearance.BackColor = Color.FromArgb(128, backColorLight); dropDownListAppearance.BackColor2 = Color.FromArgb( 128, backColor); dropDownListAppearance.BackGradientStyle = GradientStyle.ForwardDiagonal; dropDownListAppearance.BorderColor = borderColor; // Assign the Appearances to the location appearances this.ultraNavigationBar1.LocationSettings.Appearance = normalAppearance; this.ultraNavigationBar1.LocationSettings.ActiveAppearance = hotTrackAppearance; this.ultraNavigationBar1.LocationSettings.HotTrackAppearance = hotTrackAppearance; this.ultraNavigationBar1.LocationSettings.PressedAppearance = pressedAppearance; this.ultraNavigationBar1.LocationSettings.SelectedAppearance = selectedAppearance; this.ultraNavigationBar1.LocationSettings.LocationsDropDownListAppearance = dropDownListAppearance; // Set DrawsFocusRect to true to provide the end user with a visual cue // when the control receives the input focus. this.ultraNavigationBar1.DrawsFocusRect = DefaultableBoolean.True; // Assign the Appearances to the action button related appearances this.ultraNavigationBar1.ActionButtonSettings.Appearance = normalAppearance; this.ultraNavigationBar1.ActionButtonSettings.HotTrackAppearance = hotTrackAppearance; this.ultraNavigationBar1.ActionButtonSettings.PressedAppearance = pressedAppearance; // Assign the Appearances to the previous locations related appearances this.ultraNavigationBar1.PreviousLocationsSettings.DropDownButtonAppearance = normalAppearance; this.ultraNavigationBar1.PreviousLocationsSettings.DropDownButtonHotTrackAppearance = hotTrackAppearance; this.ultraNavigationBar1.PreviousLocationsSettings.DropDownButtonPressedAppearance = pressedAppearance; this.ultraNavigationBar1.PreviousLocationsSettings.DropDownListAppearance = dropDownListAppearance; // Set the control's ForeColor, which will be picked up by most elements this.ultraNavigationBar1.Appearance.ForeColor = foreColor; this.ultraNavigationBar1.HotTrackAppearance.ForeColor = foreColor; // Use Application Styling to configure the appearance of the scrollbars ApplicationStyleLibrary library = new ApplicationStyleLibrary(); StyleSetSettings styleSet = library.StyleSets.Add("Default"); styleSet.UseFlatMode = DefaultableBoolean.True; StyleSettings styleSettings = styleSet.RoleStyles.GetStyle(Infragistics.Win.AppStyling.UIRoleNames.ScrollBar, true); styleSettings.ButtonStyle = UIElementButtonStyle.PopupBorderless; AppearanceBase scrollBarAppearance = styleSettings.States.GetState(RoleState.Normal,true).Appearance; scrollBarAppearance.ThemedElementAlpha = Alpha.Transparent; scrollBarAppearance.BackColor = Color.FromArgb( 64, Color.Olive); scrollBarAppearance.ForeColor = Color.DarkOliveGreen; scrollBarAppearance.BorderColor = Color.Olive; library.UpdateStyleManager(); // Store the appearances in the control's Appearances collection for future reference this.ultraNavigationBar1.Appearances.Add( normalAppearance ); this.ultraNavigationBar1.Appearances.Add( hotTrackAppearance ); this.ultraNavigationBar1.Appearances.Add( pressedAppearance ); this.ultraNavigationBar1.Appearances.Add( selectedAppearance ); this.ultraNavigationBar1.Appearances.Add( dropDownListAppearance ); } | |
The UltraNavigationBarActionButtonSettings instance returned from the ActionButtonSettings property can be used to customize the appearance of all action buttons displayed by the control; the instance returned from the UltraNavigationBarActionButton.Settings property can be used to customize the appearance of that action button.