WPF_在APP.xaml应用资源样式

先上代码:

 1 <Application x:Class="NetAnalysis.App"
 2              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 3              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 4              xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
 5              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 6             xmlns:l="clr-namespace:NetAnalysis.Common" 
 7              StartupUri="Pages/UserDefined/UserDefinedPage.xaml">
 8     <Application.Resources>
 9         <ResourceDictionary>
10             <ResourceDictionary.MergedDictionaries>     
11                 
12                 <ResourceDictionary Source="pack://application:,,,/DictionaryStyle;component/ControlStyle/Dictionaryapp_page.xaml"/>
13                 <ResourceDictionary Source="pack://application:,,,/DictionaryStyle;component/ControlStyle/DictionaryDarwSoftware_page.xaml"/>
14 
15             </ResourceDictionary.MergedDictionaries>
16         </ResourceDictionary>
17      
18     </Application.Resources>
19 </Application>

不是单独的项目,可以直接用Source="路径就可以了";其它的一定要引用生成的样式资源dll,不然会报找不到。

原文地址:https://www.cnblogs.com/ants_double/p/5316689.html