Programmatically Showing the Search Pane

If your app is searchable and the current page has no use for text input, you should automatically treat the user’s keystrokes from the hardware keyboard as input for searching. Ideally, you would use a SearchBox and set its FocusOnKeyboardInput property to true, but you can alternatively enable this with SearchPane by setting its ShowOnKeyboardInput Boolean property to true. When you do this, any key press automatically shows the Search pane if it’s not already visible, gives focus to its search box, and populates it with the relevant text.

If your app requires text input for other reasons, you can still provide a search button of some sort that manually shows the Search pane by calling SearchPane’s ...

Get Universal Windows® Apps with XAML and C# Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.