搜索魅力:控制应用程序焦点 [英] Search charm: controlling application focus

查看:66
本文介绍了搜索魅力:控制应用程序焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在"开始"菜单中,激活"搜索"超级按钮并键入内容时,只要用户按下向下箭头键,焦点就会切换到结果列表。


是有没有办法在我自己的应用程序中重现这种行为?它是一个Javascript应用程序,甚至使用setActive()和/或focus()设置搜索结果列表的currentItem,我无法让它以与浏览器相同的方式工作。


"开始"菜单搜索和应用程序搜索之间的另一个区别似乎是"开始"菜单在屏幕的主要部分显示建议/搜索结果。普通的应用程序也应该这样做吗?或者是否支持
使用appendResultSuggestion? 

解决方案


>在"开始"菜单中,激活"搜索"超级按钮并键入内容时,只要用户按下向下箭头键,焦点就会切换到结果列表。


是有没有办法在我自己的应用程序中重现这种行为?它是一个Javascript应用程序,甚至使用setActive()和/或focus()设置搜索结果列表的currentItem,我无法让它以与浏览器相同的方式工作。


<我似乎无法重现这个问题。您是指SDK中的最新搜索示例吗?


>开始菜单搜索和应用程序搜索之间的另一个区别似乎是"开始"菜单显示主要建议/搜索结果屏幕的一部分。普通的应用程序也应该这样做吗?还是不鼓励
支持使用appendResultSuggestion?


不确定你为什么这么说。最新的搜索示例实际上显示了如何执行此操作。获得搜索结果后,您可以在主页面上执行任何操作(更改ListView的来源等,以显示已过滤的项目等)。在示例中,只需
就会在主页上显示文字。


如果您还没有尝试过,可以从以下网址获取:


http://code.msdn.microsoft.com/windowsapps/Windows-8 -Modern-Style-App-Samples


您可以在"搜索样本"下找到样本。文件夹中。


In the Start menu, when activating the Search charm and typing something, the focus shifts to the result list as soon as the user presses the arrow down key.

Is there any way to reproduce this behaviour in my own app? It's a Javascript application and even setting the currentItem of the search results list, using setActive() and/or focus(), I can't get it to work the same way as the explorer.

Another difference between the Start menu search and application search seems to be that the Start Menu shows suggestions/search results in the main portion of the screen. Are normal applications supposed to do this, too? Or is it rather discouraged in favor of using appendResultSuggestion? 

解决方案

Hi,

>In the Start menu, when activating the Search charm and typing something, the focus shifts to the result list as soon as the user presses the arrow down key.

Is there any way to reproduce this behaviour in my own app? It's a Javascript application and even setting the currentItem of the search results list, using setActive() and/or focus(), I can't get it to work the same way as the explorer.

I seem cannot reproduce this issue. Are you referring to the latest Search sample in the SDK?

>Another difference between the Start menu search and application search seems to be that the Start Menu shows suggestions/search results in the main portion of the screen. Are normal applications supposed to do this, too? Or is it rather discouraged in favor of using appendResultSuggestion?

Not sure why you say this. The latest Search sample actually shows how to do so. You can do anything on the main page (change the source of a ListView, etc, to show the filtered items, etc) after you get the search result. In the sample it just shows text on the main page.

If you haven't tried yet you can get it from:

http://code.msdn.microsoft.com/windowsapps/Windows-8-Modern-Style-App-Samples

You can find the sample under "Search sample" folder.


这篇关于搜索魅力:控制应用程序焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆