【发布时间】:2011-09-18 11:56:42
【问题描述】:
我创建了用户控件MyUserControl。现在我想创建派生自 MyUserControl 的自定义控件 MyCustomControl。 MyCustomControl.cs 代码如下:
public class MyCustomControl : MyUserControl
{
public MyCustomControl()
{
this.DefaultStyleKey = typeof(MyCustomControl);
}
}
我有带有样式的 Themes/Generic.xaml 文件
<Style TargetType="local:MyCustomControl">
...
</Style>
在运行时实例化 MyCustomControl 我得到 ArgumentException 执行该行
this.DefaultStyleKey = typeof(MyCustomControl);
我错过了什么?
【问题讨论】:
标签: silverlight silverlight-4.0