The naming style is useful when you get a set of attributes and apply them to the elements of the feature. However, if you want to apply a uniform style to all instances that determine the element type, set targettype without a key, as shown in example 5-16.
Example 5-16
<!-- no Key -->
<Style TargetType="{x:Type Button}">
<Setter Property="FontSize" Value="32" />
<Setter Property="FontWeight" Value="Bold" />
</Style>
<!-- no Key -->
<Style TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="32" />
<Setter Property="FontWeight" Value="Thin" />
<Setter Property="Foreground" Value="White" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>
<Button Grid.Row="0" Grid.Column="0" x:ID="cell00" />
<TextBlock Grid.Row="5" Grid.ColumnSpan="5" x:ID="statusTextBlock" />
As shown in example 5-16, we've got two styles, one with TargetType Button, no key, the other with TargetType TextBlock, no key. They all work the same way; When you create an instance of a button or TextBlock without realistically setting the Style property, it uses a style that matches the target type to the type of the control. Our element type style returns our game as shown in Figure 5-4.
Element type styles are convenient, and whenever you want to share an appearance for all instances of a particular element, it depends on the scope. So far, for example, in the top-level form, we've set a scope for the style in the example, example 5-17.
Example 5-17
<!-- Window1.xaml -->
<Window >
<!-- every Button or TextBlock in the Window is affected -- >
<Window.Resources>
<Style TargetType="{x:Type Button}"></Style>
<Style TargetType="{x:Type TextBlock}"></Style>
</Window.Resources>
</Window>