2015-01-10 21 views
0
<Application x:Class="Myprogram.App" 
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
      xmlns:vm="clr-namespace:Myprogram.ViewModels" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:helper="clr-namespace:Myprogram.Helper" 
      StartupUri="Views\LoginView.xaml" 
      mc:Ignorable="d">   
    <Application.Resources> 
     <helper:MathConverter x:Key="MathConverter"/> 
     <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> 
        Source="Themes/ExpressionLight.xaml">  
     </ResourceDictionary> 
    </Application.Resources>   
</Application> 

我的<Application.Resources>元素中有2個條目。該文件適用於其中之一,但兩者都不起作用。我得到的錯誤Application.Resources中的多個條目

X:關鍵屬性需要

如何添加兩者兼而有之?

+1

你應該使用一個合併的資源字典。 – MDoobie

回答

3

你需要創建一個合併的資源字典

<Application.Resources> 
    <ResourceDictionary> 
     <ResourceDictionary.MergedDictionaries> 
     <ResourceDictionary Source="Themes/ExpressionLight.xaml"/>  
     </ResourceDictionary.MergedDictionaries> 
     <helper:MathConverter x:Key="MathConverter"/> 
    </ResourceDictionary> 
</Application.Resources>