我在Visual Studio 2010中创建了一个WPF应用程序,当我在Visual Studio 2017中运行该应用程序时,它会生成以下错误:
Unhandled Exception: System.Windows.Markup.XamlParseException: 'Set property 'System.Windows.ResourceDictionary.Source' threw an exception.' Line number '8' and line position '18'. ---> System.IO.IOException: Cannot locate resource 'resourcedic/maindictionary.xaml'.
以下是我在应用程序中使用的app.xaml文件:
<Application x:Class="AttendenceSystem.UI.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="StartWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ResourceDic\MainDictionary.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
有人能帮我解决这个问题吗?如果需要更多细节,请告诉我。
maindictionary.xaml
文件中,而是在其他文件中。调试器会中断并告诉你哪个文件抛出了错误吗?是某个试图加载你的maindictionary
的文件,而不是字典本身。 - Ron Beyer