【发布时间】:2012-02-24 02:46:30
【问题描述】:
我正在使用继承自 TextBox 的自定义 TextBox:
Public Class MyTextBox: Inherits TextBox
...
End Class
我希望此类使用在 classic.xaml ResourceDictionary 中定义的样式。我试过这个:
<Style x:Key="{x:Type uc:MyTextBox}" BasedOn="{StaticResource {x:Type TextBox}}"/>
<Style x:Key="{x:Type TextBox}"
BasedOn="{StaticResource {x:Type TextBoxBase}}"
TargetType="{x:Type TextBox}">
<!-- predefined style in classic.xaml-->
</Style>
但我收到一条错误消息,指出样式只能基于 IFrameworkInputElement 类型。
这应该是微不足道的,不是吗?
【问题讨论】: