Delen via


SearchBox.PrepareForFocusOnKeyboardInput Event

Definition

Occurs when the FocusOnKeyboardInput property is true and the app receives textual keyboard input.

// Register
event_token PrepareForFocusOnKeyboardInput(TypedEventHandler<SearchBox, RoutedEventArgs const&> const& handler) const;

// Revoke with event_token
void PrepareForFocusOnKeyboardInput(event_token const* cookie) const;

// Revoke with event_revoker
SearchBox::PrepareForFocusOnKeyboardInput_revoker PrepareForFocusOnKeyboardInput(auto_revoke_t, TypedEventHandler<SearchBox, RoutedEventArgs const&> const& handler) const;
public event TypedEventHandler<SearchBox,RoutedEventArgs> PrepareForFocusOnKeyboardInput;
function onPrepareForFocusOnKeyboardInput(eventArgs) { /* Your code */ }
searchBox.addEventListener("prepareforfocusonkeyboardinput", onPrepareForFocusOnKeyboardInput);
searchBox.removeEventListener("prepareforfocusonkeyboardinput", onPrepareForFocusOnKeyboardInput);
- or -
searchBox.onprepareforfocusonkeyboardinput = onPrepareForFocusOnKeyboardInput;
Public Custom Event PrepareForFocusOnKeyboardInput As TypedEventHandler(Of SearchBox, RoutedEventArgs) 
<SearchBox PrepareForFocusOnKeyboardInput="eventhandler"/>

Event Type

Remarks

This event occurs only if the FocusOnKeyboardInput property is true. If you wan to provide "type-to-search" behavior in your app, you should handle this event and synchronously ensure the SearchBox control is visible before the event call completes. After this event occurs, the control sets focus to itself.

When FocusOnKeyboardInput is true, keyboard input on the current thread is intercepted and textual input is redirected to the SearchBox. Only textual input will cause the SearchBox to receive focus. Non-text keys, such as arrows or Tab, are not redirected to the SearchBox. WIN/CTRL/ALT key combinations (except for Ctrl-V for paste) are also not redirected.

Applies to

See also