WPF中的自定义控件新手,我无法弄清楚为什么它没有在Expression Blend中显示但在运行时显示正常。
我正在尝试在usercontrol中使用CustomControl。
我在AssemblyInfo.cs中有这个(如其他帖子所示)
[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)
)]
和此:
public class ColorPicker : Control
{
static ColorPicker()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(ColorPicker),
new FrameworkPropertyMetadata(typeof(ColorPicker)));
}
我测试了一个全新的WPF项目,加载自定义控件正常工作,我可以在Expression Blend中看到它。但这与我当前的usercontrol项目不起作用......
我猜自定义控件中的Generic.xaml未正确加载但无法找到解决该问题的任何方法。