让我们试着清楚地解释一下.
我有一个自定义控件作为WPF应用程序构建,它工作正常.我已将所有代码移动到外部DLL中.在此更改之后,当我加载应用程序时,不再调用OnApplyTemplate()方法,并且不会呈现控件
你对这个解决方案有什么想法吗?
提前致谢...
标准Wpf Applicaton和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)
)]
Run Code Online (Sandbox Code Playgroud)
将这些代码行添加到您的程序集应该可以修复您的错误.