2012-08-26 52 views
2
protected override void OnWindowCreated(WindowCreatedEventArgs args) 
    { 
     // Register QuerySubmitted handler for the window at window creation time and only registered once 
     // so that the app can receive user queries at any time. 
     SearchPane.GetForCurrentView().QuerySubmitted += new TypedEventHandler<SearchPane, SearchPaneQuerySubmittedEventArgs>(OnQuerySubmitted); 
    } 

似乎无法覆盖onWindowCreated我甚至都没有在App.xaml.cs的覆盖智能感知上看到它。我在这里错过了什么吗?我下载了一个示例搜索合同应用程序任何人都知道我错过了什么?为什么我不能重写OnWindowCreated,我不能看到ShowOnKeyBoardInput属性?

即使这部分缺失

 SearchPane.GetForCurrentView().ShowOnKeyboardInput = true; 
     SearchPane.GetForCurrentView().ShowOnKeyboardInput = false; 

ShowOnKeyboardInput不存在。

为什么我不能覆盖OnWindowCreated,我没有能看到ShowOnKeyBoardInput财产

UPDATE:http://code.msdn.microsoft.com/windowsapps/Search-app-contract-sample-118a92f5/view/Discussions

+0

狮子座,你可以改变这个项目的标题是问题形式?究竟是什么问题...不能重写OnWindowCreated? –

+0

是的,乔恩爵士。 :P –

+0

我与App设置示例演示有同样的问题。你有没有设法解决这个问题? – nicruo

回答

0

我发现问题是什么。

在Windows 8 RTM版本中实现了OnWindowCreated方法。所以如果你仍然遇到这个问题,请升级你的Windows。

+0

似乎合法,我没有升级我的Windows。 –

0

的App.xaml不是一个窗口,并没有从窗口继承。您需要将此代码放置在窗口中才能使用。

编辑:实际上框架中没有任何一个OnWindowCreated覆盖,我可以看到。这是C#的样本吗?你能发布一个链接到样本吗?

+0

我知道。检查MSDN文档,这是Windows 8. –

+0

@LeoLuis好的,这是VS2012,我认为.net 4.5你使用这些? – MikeKulls

+0

是的。我在Windows 8/VS 2012 –

相关问题