Search is one of the key features of Windows 8 and can be invoked at any time using Search charm. Additionally, Start screen behaves similar to Windows 7 Start menu and starts searching when user typed something. Like in Windows 7, you can press Windows key, type something and the search results will immediately appear on the screen. It’s a nice feature and some apps can benefit from this approach too.

While you can implement type-to-search scenario in your app by yourself (by catching KeyPress and invoking Search pane), Windows 8 RTM provides standard implementation for this scenario:


SearchPane.GetForCurrentView().ShowOnKeyboardInput = true;

That’s it. By setting this property you instruct system to automatically route all keystrokes to Search, so the current view behaves similar to Start screen.

It is important to understand, that system will intercept every key press. Even if active view contains an EditBox and this EditBox is in focus, all entered characters will be routed to Search pane and the EditBox will stay empty.

Value of ShowOnKeyboardInput can be set at any time and you can switch on / switch off search functionality over and over again.

blog comments powered by Disqus