說我有一個標準按鈕的主題文件Button.xaml。如何在組件設計器中隱式應用主題?
通過合併到應用程序資源字典中,它可以隱式應用於應用程序項目設計器中。
但我將Button.xaml移動到組件項目後,組件項目設計器不能隱式應用主題文件。
我怎樣才能使該主題文件隱式地在組件項目中工作?
更新: 的Themes.xaml如下
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/StyleLibrary;component/Themes/Shared.xaml" />
<ResourceDictionary Source="pack://application:,,,/StyleLibrary;component/Themes/Button.xaml" />
<ResourceDictionary Source="pack://application:,,,/StyleLibrary;component/Themes/ComboBox.xaml" />
...
<Application x:Class="ButtonStyleTest.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/StyleLibrary;component/Themes.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
如果我使用合併Theme.xaml,按鈕看在設計師正常,但在運行時失敗。 但是,如果我將Button.xaml,ComboBox一個接一個地合併,它對於設計和運行時都是正常的。
這是usaully在我的情況下,一些新的模塊,應用項目的測試,然後將它建成後搬進組件項目。這將節省一些編譯時間。 – user244980 2010-11-02 13:21:06