WPF resources addin

本小妞迷上赌 提交于 2020-01-15 12:19:05

问题


I have a WPF application that runs as an add-in in another application. (In this case it is COM based but I don't think it matters for the problem I have)

The application works fine when I run it standalone. When running as add-in there is a problem with resources.

First: (minor)

The "pack:" uri scheme is not available at all. I can work around this but it would be nice to understand why (and if it can be solved)

Second: (showstopper)

XAML resources can't be found (the XAML is found!). The errormessages says that Assembly.GetEntryAssembly() is null (which is understandable) and that I should set Application.ResourceAssembly.

The problem is that my application consists of 2 assemblies which both contain XAML and resources. Which one should I set as resource assembly? I have tried both and neither of them work. (The errormessage just says that the resource can't be found)

The resources that can't be found are normal text with an autogenerated static class. The XAML looks like:

<TextBox Text="{StaticResource my:Texts.ButtonText}">

来源:https://stackoverflow.com/questions/1617343/wpf-resources-addin

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