FocusState Enum

Definition

Describes how an element obtained focus.

public enum class FocusState
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.WinUIContract, 65536)]
enum class FocusState
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.WinUIContract), 65536)]
public enum FocusState
Public Enum FocusState
Inheritance
FocusState
Attributes

Fields

Name Value Description
Unfocused 0

Element is not currently focused.

Pointer 1

Element obtained focus through a pointer action.

Keyboard 2

Element obtained focus through a keyboard action, such as tab sequence traversal.

Programmatic 3

Element obtained focus through a deliberate call to UIElement.Focus(Microsoft.UI.Xaml.FocusState) or a related API.

Remarks

If used as an input parameter for UIElement.Focus(Microsoft.UI.Xaml.FocusState), you can't use Unfocused. The FocusState value to pass to a UIElement.Focus(Microsoft.UI.Xaml.FocusState) call depends on the input scenario and which user interaction your control or app code is responding to.

The exact meaning of the FocusState values depends on whether you're reading it from UIElement.FocusState, or using a value to send to UIElement.Focus(Microsoft.UI.Xaml.FocusState). If you are setting UIElement.Focus(Microsoft.UI.Xaml.FocusState) you're informing other callers (like the control templates) about how that control obtained focus.

Applies to

See also