Dela via


AutomationPeer.HasKeyboardFocusCore Method

Definition

Provides the peer's behavior when a Microsoft UI Automation client calls HasKeyboardFocus or an equivalent Microsoft UI Automation client API.

protected:
 virtual bool HasKeyboardFocusCore() = HasKeyboardFocusCore;
bool HasKeyboardFocusCore();
protected virtual bool HasKeyboardFocusCore();
function hasKeyboardFocusCore()
Protected Overridable Function HasKeyboardFocusCore () As Boolean

Returns

Boolean

bool

true if the element has keyboard focus; otherwise, false.

Remarks

The standard implementation at the AutomationPeer level checks whether the owner has focus, and always returns false if the owner isn't focusable. FrameworkElementAutomationPeer expands this behavior somewhat because it adds awareness of owner characteristics that rely on the owner being a Control subclass. Test the existing return value in the peer that you are using or overriding and then override that behavior if necessary.

Applies to

See also