Version

UseBrowserDefaults Property (WebButtonBase)

This property allows to automatically adjust appearance related properties to match with appearance of edit-field and drop-down button elements used by a particular browser on the client.
Syntax
'Declaration
 
Public Property UseBrowserDefaults As Boolean
public bool UseBrowserDefaults {get; set;}
Remarks

Default value is true.

Note: If any appearance related property is set, then those values are not affected and they have priority over corresponding "automatic" defaults.

At the time the WebButtonBase supports only 3 types of predifined styles:

  • Internet Explorer under Windows2000.
  • Netscape Navigator regardless of platform.
  • Internet Explorer (blue) under WindowsXP.

Example
That property allows automatically configure appearance of button according to the standard button in the browser of end user. In case of InternetExplorer or Netscape 7.2 on WindowsXP, button will automatically use background images to create rounded corners. In case of Netscape 6.2 or Netscape 7.0 on any Windows machine, button will automatically use 2 pixel wide borders. In case of Macintosh, button will automatically use rounded blue images with restricted height.

' If any background or border related property is set, then they will
' have priority over possible rounded images regardless of the UseBrowserDefaults.
' For example, the following example will draw button with rectangle borders under any browser.
'Me.WebImageButton1.UseBrowserDefaults = True
Me.WebImageButton1.Appearance.Style.BackColor = System.Drawing.SystemColors.Control

' Since the WebImageButton has ability to create RoundedCorners by 2 different ways,
' the UseBrowserDefaults can be combined with the RenderingType.
' The following example under WindowsXP will draw rounded button with WindowsXP-Blue-Theme using
' 1-pixel-table-cells instead of the default background images.
'Me.WebImageButton1.UseBrowserDefaults = True
Me.WebImageButton1.RoundedCorners.RenderingType = Infragistics.WebUI.WebDataInput.ButtonRoundedCornersType.BordersByTableCells
' Note: under Netscape 6.2 and some other browsers, colors of background and borders can be different from the WindowsXP-Blue-Theme.

' If UserBrowserDefaults is disabled, then all appearance related properties are used as they are.
' It means that if nothing is set, then button appears transparent and borderless.
' Below is the simlest example with custom appearances
Me.WebImageButton1.UseBrowserDefaults = False
Me.WebImageButton1.Appearance.Style.BackColor = System.Drawing.SystemColors.Control
Me.WebImageButton1.Appearance.Style.BorderColor = Color.White
Me.WebImageButton1.Appearance.Style.BorderStyle = BorderStyle.Outset
Me.WebImageButton1.Appearance.Style.BorderWidth = Unit.Pixel(1)
Me.WebImageButton1.PressedAppearance.Style.BorderStyle = BorderStyle.Inset

' Note: if codes above are written within aspx, then it reduces the size of hidden ViewState passed to client
// If any background or border related property is set, then they will
// have priority over possible rounded images regardless of the UseBrowserDefaults.
// For example, the following example will draw button with rectangle borders under any browser.
//this.WebImageButton1.UseBrowserDefaults = true;
this.WebImageButton1.Appearance.Style.BackColor = System.Drawing.SystemColors.Control;

// Since the WebImageButton has ability to create RoundedCorners by 2 different ways,
// the UseBrowserDefaults can be combined with the RenderingType.
// The following example under WindowsXP will draw rounded button with WindowsXP-Blue-Theme using
// 1-pixel-table-cells instead of the default background images.
//this.WebImageButton1.UseBrowserDefaults = true;
this.WebImageButton1.RoundedCorners.RenderingType = Infragistics.WebUI.WebDataInput.ButtonRoundedCornersType.BordersByTableCells;
// Note: under Netscape 6.2 and some other browsers, colors of background and borders can be different from the WindowsXP-Blue-Theme.

// If UserBrowserDefaults is disabled, then all appearance related properties are used as they are.
// It means that if nothing is set, then button appears transparent and borderless.
// Below is the simlest example with custom appearances
this.WebImageButton1.UseBrowserDefaults = false;
this.WebImageButton1.Appearance.Style.BackColor = System.Drawing.SystemColors.Control;
this.WebImageButton1.Appearance.Style.BorderColor = Color.White;
this.WebImageButton1.Appearance.Style.BorderStyle = BorderStyle.Outset;
this.WebImageButton1.Appearance.Style.BorderWidth = Unit.Pixel(1);
this.WebImageButton1.PressedAppearance.Style.BorderStyle = BorderStyle.Inset;

// Note: if codes above are written within aspx, then it reduces the size of hidden ViewState passed to client
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, 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