In this article we will learn how to use Named
Styles in WPF using VB.NET.
Named styles
The named styles has a name and we use that
name on the control with the style property.
For example
This example describes the named styles.
Drag and drop the Button and TextBox control on
the form.

Figure 1.
Now applying the styles on these control.
StaticResource - StaticResource is used
to get reference of the style.
Style="{StaticResource
roh}"
Xaml code
<Window
x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow"
Height="350"
Width="525">
<Window.Resources>
<Style
x:Key="roh">
<Setter
Property="Control.FontSize"
Value="32"
/>
<Setter
Property="Control.FontWeight"
Value="Bold"
/>
<Setter
Property="Control.Background"
Value="red"/>
<Setter
Property="Control.Foreground"
Value="green"
/>
</Style>
</Window.Resources>
<Grid
>
<Button
Content="Button"
Height="72"
Name="Button1"
Width="176"
Style="{StaticResource
roh}"
Margin="154,174,173,65"
/>
<TextBox
Height="72"
HorizontalAlignment="Left"
Margin="81,76,0,0"
Name="TextBox1"
VerticalAlignment="Top"
Width="331"
Style="{StaticResource
roh}"
Text="This
is a textBox." />
</Grid>
</Window>
Now run the application and test it.

Figure 2.