Insert a WPF Resource Dictionary into a class library via Visual Studio 2010

早过忘川 提交于 2019-12-07 03:14:39

问题


I have a class library and want to change the type so that I also can add a WPF resource dictionaries. I have added the WPF references and also tried to sync the AssemblyInfo.cs file with a project that allows the addition of such resource files, however without success.

If I use the add-new-dialog from Visual Studio, the template for WPF resource dictionaries is not available - If I create the file manually and then reference it, all works fine.

How can I change my project to a WPF custom control library project so that Visual Studio allows me to add WPF resource dictionaries. Or are there any drawbacks or pitfalls so that I must not do that and better create a new project-file?


回答1:


It seems to be defined in the csproj-File. If I add the following line into the PropertyGroup-Section, I can do what I'm looking for:

<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

Please note
Although I have found the location where the definiton resides, I have not used the changed version of the csproj-File. I have created a new project with the desired settings. There seem to be a lot of additional project-settings between a control library and a class library and maybe only adding the above guids may result in unexpected behaviour of the project/solution.



来源:https://stackoverflow.com/questions/9605987/insert-a-wpf-resource-dictionary-into-a-class-library-via-visual-studio-2010

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!