Do you want to really impress the users of your Windows Store applications with a single line of code? If you answered yes, and I’m assuming you would, then read on. If you answered no, well, then, I don’t really know what to say, but I would encourage you read on as well.
One of the cool features in Windows 8 is the Search charm. This allows you to search across the system and within apps to find exactly what you’re looking for. As developers we can leverage this by implementing the Search contract. This contract allows you to add a search pane to your apps that enables users to search within your app both while the app is running as well as from anywhere in the system. Adding the search capability is fairly straightforward and I have some links at the end of this post that can get you on your way. However, if you follow the tutorials you will be left with a suboptimal implementation. Your apps will have a search, but the user will have to activate the Search charm either by using the mouse and dragging the cursor to the upper or lower right hand corner, by using touch and swiping from the right edge of the screen, or by using the keyboard shortcut (Windows Key + Q). This is how the native Windows Store, Music, and Video apps implement search today. While all of the options work, it’s one extra thing the user has to do when what he or she really wants to do is search. Instead, wouldn’t it be better if search would just start when the user starts typing on the keyboard (either a physical keyboard or the onscreen keyboard)? Well you can with just one line of code. Here it is:
I know, I just blew your mind right?! Hope it helps!
(Yes, I know the gist has more than one line of code in it, but I wanted to put it context of where you would use it. In this case I wired it into the OnNavigatedTo event of a page.)
Resources for adding Search to your Windows Store apps: