Partager via


HtmlElement.Focus Method

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

Sets the browser focus to the current HTML element.

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

Syntax

'Declaration
<SecuritySafeCriticalAttribute> _
Public Sub Focus
[SecuritySafeCriticalAttribute]
public void Focus()

Exceptions

Exception Condition
InvalidOperationException

All errors.

Remarks

No action is taken if the current element cannot have its focus set.

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.