无法找到资源目录的指定文件 [英] unable to find the specified file for resource directory

查看:113
本文介绍了无法找到资源目录的指定文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿伙计们,


解决方案

如何在Application项目中引用控件库?我们在这里有两个场景:

[项目参考]:例如:Application1有一个项目参考Control Library1
1。在应用项目中打开App.xaml
2。切换到资源窗格并链接App.xaml中的ResourceDictionary1(即右键单击App.xaml并单击链接到资源字典)

使用此资源字典中定义的所有资源现在可用于应用项目

[组装参考]:例:Application1具有对控制库1的装配参考。在应用项目中打开App.xaml
2。使用以下语法在Control Library项目中合并ResourceDictionary,其中ControlLibrary1是库项目的名称。

如果这是Silverlight控件库,则需要添加x:Class =" ResourceDictionary"在ResouceDictionary XAML文件中(在定义的命名空间旁边)。

< ResourceDictionary>


< ResourceDictionary .MergedDictionaries>


< ResourceDictionary Source =" / ControlLibrary1; Component / ResourceDictionary1.xaml" />


< /ResourceDictionary.MergedDictionaries>


< / ResourceDictionary>

注意:使用程序集参考Blend现在可以解析资源字典中定义的资源,但不会提供任何UI来编辑这些资源。

请告诉我们这是否适合您。


hey guys,


解决方案

Hi,
      How Control library is being referenced in the Application project? We have two scenarios here:

[Project Reference]: Ex: Application1 has a Project reference to Control Library1
1. Open App.xaml in Application project
2. Switch to Resource Pane and link the ResourceDictionary1 in App.xaml (i.e Right click on App.xaml and click on Link to Resource Dictionary)

Using this all the resources defined in the ResourceDictionary will now be available in the Application project


[Assembly Reference]: Ex: Application1 has assembly reference to Control Library1
1. Open App.xaml in Application project
2. Merge ResourceDictionary in Control Library project using following syntax, where ControlLibrary1 is the name of the library project.

Also if this is a Silverlight Control Library, you will need to add x:Class="ResourceDictionary" (next to defined namespaces) in ResouceDictionary XAML file.
   

<ResourceDictionary>

         <ResourceDictionary.MergedDictionaries>

                      <ResourceDictionary Source="/ControlLibrary1;Component/ResourceDictionary1.xaml"/>

          </ResourceDictionary.MergedDictionaries>

</ResourceDictionary>

Notes: Using assembly reference Blend will now be able to resolve the resources defined in the Resource Dictionary but will not provide any UI to edit these resources.

Let us know if this works for you.


这篇关于无法找到资源目录的指定文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆