让我们试着解释清楚。
我有一个作为 WPF 应用程序构建的自定义控件,它工作得很好。我已将所有代码移至外部 DLL 中。进行此更改后,当我加载应用程序时,该方法OnApplyTemplate()不再被调用,并且控件也不再呈现
- 我尝试过通用.xaml文件是一个Themes目录(大写T)在 DLL 的根目录中,该 DLL 具有控件和/或Themes目录进入 StartUp 项目。
- 如果此信息很重要,那么我在这里找到了控件:http://www.codeproject.com/KB/WPF/WPFOutlookCalendar.aspx
- The settings of the project is
- 我创建了一个简单的 DLL 项目并手动添加了引用
您对解决方案有什么想法吗?
提前致谢...
标准 Wpf 应用程序和 WPF 自定义控件库之间的主要区别在于以下几行代码。
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
将这些代码行添加到程序集中应该可以修复您的错误。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)