WPF自定义控件无法执行OnApplyTemplate

一、检查调用文件的路径

dll--》Themes文件夹--》Generic.xaml资源字典---》Generic.xaml中对自定义控件的引用---》App.xaml引用Generic.xaml

二、检查Assembly.cs文件中是否包含样式的默认获取方式

[assembly:ThemeInfo(ResourceDictionaryLocation.None, //主题特定资源词典所处位置(未在页面中找到资源时使用,或应用程序资源字典中找到时使用)
ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置 (未在页面中找到资源时使用,应用程序或任何主题专用资源字典中找到时使用)
)]

 

posted @ 2024-07-30 16:42  Morning=Sunshine  阅读(55)  评论(0)    收藏  举报