2016-03-04 69 views
1

我目前使用T10開發簡單的應用程序,通過使用空白模板。然後,我從漢堡模板看到你申請Custom.xaml主題爲App.xaml中加入Application.ResourceApp.xaml這樣無法將ResourceDictionary添加到App.xaml

<common:BootStrapper x:Class="T10Hamburger.App" 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:common="using:Template10.Common"> 

    <Application.Resources> 
     <ResourceDictionary Source="Styles\Custom.xaml" /> 
    </Application.Resources> 

</common:BootStrapper> 

我做同樣的事情到我的項目,但我發現了XAML例外。

這裏是異常的消息:

「錯誤HRESULT E_FAIL已經從一個COM組件 調用返回」

我錯過了什麼嗎?

注意:一張小紙條,當我試圖手動鍵入Application.Resource進入App.xaml中,智能感知沒趕上Application一部分,但後來表明,當我試圖用Resource

+1

請發佈例外/錯誤。 –

+0

看看問題[這裏](http://stackoverflow.com/questions/35852051/adding-basedon-style-on-app-xaml-is-crashing-on-app-initializecomponent)。看起來像'BasedOn'其他樣式導致問題的樣式。在刪除違規風格後,看看您的問題是否會消失。我做到了。 – akshay2000

回答

2

對我來說,把它完成您的問題就在這裏:

<Application.Resources>應該<common:BootStrapper.Resources>

換句話說,你應該有:

<common:BootStrapper x:Class="T10Hamburger.App" 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:common="using:Template10.Common"> 

    <common:BootStrapper.Resources> 
     <ResourceDictionary Source="Styles\Custom.xaml" /> 
    </common:BootStrapper.Resources> 

</common:BootStrapper> 
+0

仍然有異常(當我嘗試添加時,Intellisense也無法檢測到BootStrapper)。但是你的回答揭穿了我的一個假設,所以謝謝 –

+0

您使用的是什麼版本的模板10?是模板10項目的樣本嗎? – Damien

+0

它的版本1.1.3 –

0

重新啓動Visual Studio是我的解決方案。

相關問題