Reputation: 16121
I am using a custom TextBox that inherits from TextBox:
Public Class MyTextBox: Inherits TextBox
...
End Class
I want this class to use the Style that is defined in the classic.xaml ResourceDictionary. I tried this:
<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>
But I am greeted with an error message stating that the style can only be based on a type of IFrameworkInputElement.
This should be trivial, shouldn´t it?
Upvotes: 3
Views: 616
Reputation: 25211
You need to add TargetType="{x:Type uc:MyTextBox}"
to your style.
Upvotes: 2