2012-08-26 54 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 –

相關問題