locked
Possible to focus listview after search completed?

    Question

  • Currently the Search Charm keeps the focus in the search text box even after the user has pressed ENTER or executed the search via search button.

    However, if you press the Windows key and start typing to find apps, the result page on the left focuses the first item in the listview instantly and you can navigate using the keyboard in the results. That's not possible with my own app. I am setting the focus on the listview, but the focus remains in the search charm.

    Friday, April 20, 2012 10:42 AM

Answers

  • No, you cannot do this in your own application.  The Start screen jumps through a lot of hoops to accomplish this today and you should not attempt to do this in your own application.  The product team is aware of the desire for an interface to accomplish this however so thanks for the feedback on you wanting to be able to do this in your applications!

    -Jeff


    Jeff Sanders (MSFT)

    Tuesday, April 24, 2012 6:39 PM
    Moderator

All replies

  • Hi Phil,

    I am having difficulty understanding the issue.  Are you saying you want to affect the way the search charm search works by default?  You cannot do this.

    -Jeff


    Jeff Sanders (MSFT)

    Tuesday, April 24, 2012 1:53 PM
    Moderator
  • I want the effect how the start menu works. Try it as I described above. It sets the focus to the first found app.
    Tuesday, April 24, 2012 2:05 PM
  • Hi Phil,

    No you cannot change how the start menu works (sorry, not enough coffee yet today).

    -Jeff


    Jeff Sanders (MSFT)

    Tuesday, April 24, 2012 2:28 PM
    Moderator
  • You need even more coffee Jeff ;)

    That was not what I was asking. Please read my initial post again and try to reproduce the behaviour on your machine. I do not want to change how the start menu works, I want to set the focus to an item in my app when a user searched in my app.

    Tuesday, April 24, 2012 2:51 PM
  • The underlying problem is that the search behaviour in the start menu is different from the search behaviour in other apps which have no way of giving the user the same user experience as the start menu does.
    Tuesday, April 24, 2012 2:54 PM
  • OK,

    You can get similar input.  See the Search Extension Sample.  Pick scenario 5 for example

    As you type in search (with the app activated) you will see the string being reflected in the app.  You can filter your results similarly and set the selected item, however there is no way to get keyboard control over into your app.  Focus is estabished only when you close that flyout.  I will double check with the team however to see if there is a way to do what you want.  I do not think you can add a keyboard event handler to the search pane...

    -Jeff


    Jeff Sanders (MSFT)

    Tuesday, April 24, 2012 3:53 PM
    Moderator
  • No, you cannot do this in your own application.  The Start screen jumps through a lot of hoops to accomplish this today and you should not attempt to do this in your own application.  The product team is aware of the desire for an interface to accomplish this however so thanks for the feedback on you wanting to be able to do this in your applications!

    -Jeff


    Jeff Sanders (MSFT)

    Tuesday, April 24, 2012 6:39 PM
    Moderator
  • Thanks for checking that Jeff!

    You know, for once I really hoped MSFT would not make use of "private APIs" in their implementation of the Metro experience. That's something that really annoyed me in Win32 always. And once the APIs go "semi"-public through reverse engineering and are used by some BIG players MSFT would have to go through all the trouble to back-support such API hacks. I have read "The Old New Thing". Please, MSFT, consider making this functionality official behaviour for all Metro apps with "Release Preview" or RTM.

    Tuesday, April 24, 2012 9:23 PM
  • "The product team is aware of the desire for an interface to accomplish this"

    Jeff Sanders (MSFT)

    Wednesday, April 25, 2012 12:08 PM
    Moderator