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

Keyboard 2

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

Pointer 1

Element obtained focus through a pointer action.

Programmatic 3

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

Unfocused 0

Element is not currently focused.

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