I created the baseStyle style as follows:
<Style TargetType="{x:Type Control}" x:Key="baseStyle">
<Setter Property="FontSize" Value="30" />
<Setter Property="FontFamily" Value="Saumil_guj2" />
</Style>
Then I used it for ListBoxItem, for example:
<Style TargetType="{x:Type ListBoxItem}" BasedOn="{StaticResource baseStyle}">
</Style>
He gladly accepts FontSizeand FontFamilyfrom baseStyle.
I tried to do a similar thing for TextBlock:
<Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource baseStyle}">
</Style>
Now he is complaining. I mean, this gave me the opportunity:
InvalidOperationException: Can only base on a Style with target type
that is base type 'TextBlock'.
So, I checked the MSDN.
There I discovered that ListBoxItem comes indirectly from System.Windows.Controls. Here can be found here .
There I also found that TextBlock also comes from System.Windows.Controls. You can find it here.
So, I do not understand why I am getting this error?