I have a TextBox Style with a Key defined in external resource dictionary file, then I’m trying to define a new implicit TextBox Style that sets “Keyed” style from resource dictionary, so basically I want to seet the style from resource dictionary as a default for TextBox, but I can’t remove Key from there, because it is used by other code.
<ResourceDictionary Source="FileWithNiceTextBoxStyle.xaml"/>
<Style TargetType="TextBox">
<Setter Property="Style" Value="{StaticResource NiceTextBoxStyle}"/>
</Style>
However this doesn’t work, and result in Visual Studio crash.
Use the
BasedOnattribute: