Partager via


HtmlElement.SetStyleAttribute Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Sets the value of a style attribute on the current HTML element.

Namespace:  System.Windows.Browser
Assembly:  System.Windows.Browser (in System.Windows.Browser.dll)

Syntax

'Declaration
Public Sub SetStyleAttribute ( _
    name As String, _
    value As String _
)
public void SetStyleAttribute(
    string name,
    string value
)

Parameters

  • name
    Type: System.String
    The style attribute whose value will be set.

Exceptions

Exception Condition
ArgumentException

name is an empty string.

ArgumentNullException

name is nulla null reference (Nothing in Visual Basic).

Remarks

If the style attribute is not recognized, this method's behavior is determined by the browser.

You can pass nulla null reference (Nothing in Visual Basic) for the value parameter.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.