3

I want to add a search contract to my Windows Store App. I'm using VS2013 and several different tutorials instruct me to choose PROJECT > Add New Item... and then select the Installed > Visual C# > Windows Store category which, they say, should include an item "Search Contract"

It's not present in my plain vanilla installation. There is a "Search Results Page", which I have tried adding, but which doesn't seem to set up any contract boilerplate or add the requisite manifest entry.

No Search Contract

Am I nuts, am I using the wrong version of something or is there some installation I have yet to perform?

Breaking news, it's only missing from VS2013. It's present and operational in VS2012 which leaves me with the burning question:

Why is Search Contract missing from VS2013 and what am I supposed to use instead?

Experimenting with VS2012 I notice that the when you select the old "Search Contract" template the suggested file name is SearchResultsPage1.xaml which implies that this template was simply renamed to "Search Results Page". But it doesn't seem to work any more.

Several sources, including magincandre1981 below and a Microsoft staffer (on another Q+A site) have told me that apps providing search to the search charm is defunct and now it's in-app only.

Yet this is contradicted by the fact that the Win 8.1 samples contain a working example of implementing the Search contract.

Andre points out that users have reported that the search charm causes 100% CPU usage.

I can believe this. Essentially the OS calls into your app. Most of WinRT is designed to make it impossible to ruin the user experience by being selfish and stupid, but in this case there's nothing to limit our excesses, and it is entirely possible to wreak havoc. My own code is fully async, but getting this to work required me to learn several things, deferral in particular.

In that context, pulling the feature would be a predictable move for MS... yet they didn't. The sample above works. Talk about mixed messages!

4

1 回答 1

1

Windows 8.1 中,您的应用程序必须自行实现搜索

从现在开始,Windows 应用商店应用完全负责实现应用内搜索功能 - Search Charm 不再支持 Search Contract 并且不再触发应用内搜索 为了促进这种新的设计模式,WinRT for Windows 8.1 包括新的搜索框 UI 控件和一组用于索引和搜索应用程序数据的 API。

于 2013-11-01T06:18:50.057 回答