Style With Multiple Elements

image_pdfimage_print


   
    

<StackPanel xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <StackPanel.Resources>
        <Style x:Key="normal">
            <Setter Property="Control.FontSize" Value="24" />
            <Setter Property="Control.Foreground" Value="Blue" />
            <Setter Property="Control.HorizontalAlignment" Value="Center" />
            <Setter Property="Control.Margin" Value="24" />
            <Setter Property="Control.Padding" Value="20, 10, 20, 10" />
        </Style>
    </StackPanel.Resources>

    <TextBlock Style="{StaticResource normal}">
        TextBlock
    </TextBlock>

    <Button Style="{StaticResource normal}">
        Button
    </Button>
</StackPanel>