【问题标题】:Vs2017: An Error Occured while finding the resource dictionaryvs2017:查找资源字典时出错
【发布时间】:2017-07-12 04:45:14
【问题描述】:

当我尝试引用资源字典我的 app.xaml 文件时出现以下错误

<Application x:Class="DesignerPoc.App"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:local="clr-namespace:DesignerPoc"
         StartupUri="MainWindow.xaml">
<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="pack://application:,,,/Dashboard.Designer.WPF;Connection/Views/test.xaml"/>
          </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
 </Application.Resources>

错误

An Error occurred while finding the resource dictionary "pack://application:,,,/Dashboard.Designer.WPF;Connection/Views/test.xaml"

refer the image

如何解决这个问题??

【问题讨论】:

  • 添加该资源后,您是否构建了项目?有时 VS 设计器需要构建才能找到资源。此外,当您运行应用程序时,它是否会引发找不到资源的异常?
  • 是的。当我构建显示构建成功没有任何错误但是当我运行我的项目应用程序进入中断状态。

标签: wpf data-binding resourcedictionary


【解决方案1】:

您的Resource File Pack URI 错误。

它应该看起来像这样,包括component 部分:

pack://application:,,,/Dashboard.Designer.WPF;component/Connection/Views/test.xaml

【讨论】:

    猜你喜欢
    • 2013-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多