[WPF] 将普通的Library工程,改造成WPF Custom Control 的Library

1. 添加References

PresentationCore
PresentationFramework
System.Xaml
WindowsBase
2. 修改AssemblyInfo.xs
using System.Windows;

[assembly: System.Windows.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)
)]

3. 创建Themes文件夹,然后创建Generic.xaml

原文地址:https://www.cnblogs.com/mantian/p/3808478.html