WebView.Focus method

Applies to Windows and Windows Phone

Sets the input focus to the WebView.

Syntax


public:
bool Focus(
  FocusState value
)

Parameters

value

Type: FocusState

A value that indicates how the focus was set.

Return value

Type: System.Boolean [.NET] | Platform::Boolean [C++]

true if focus was set; otherwise, false.

Remarks

In apps compiled for Windows 8, the WebView control automatically gets input focus whenever you use script to programmatically set the focus to some content in the WebView. In apps compiled for Windows 8.1, this does not occur automatically. Instead, you must call the Focus method to set the focus to the WebView control and also use script to set the focus to some content in the control.

When you call this method, you will typically pass in a FocusState value of Programmatic. Use the Pointer and Keyboard values when you call this method in response to direct user input. You cannot use this method to remove input focus from the control. The Unfocused value will throw an exception.

Requirements

Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.UI.Xaml.Controls
Windows::UI::Xaml::Controls [C++]

Metadata

Windows.winmd

See also

WebView

 

 

Show:
© 2014 Microsoft