■ Style 엘리먼트 : 다른 타입에 적용하기

----------------------------------------------------------------------------------------------------

<StackPanel

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <StackPanel.Resources>

        <Style x:Key="NormalStyleKey">

            <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>

    <Button    Style="{StaticResource NormalStyleKey}">스택 첫번째 버튼</Button>

    <TextBlock Style="{StaticResource NormalStyleKey}">스택 가운데 텍스트 블럭</TextBlock>

    <Button    Style="{StaticResource NormalStyleKey}">스택 마지막 버튼</Button>

</StackPanel>

----------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker
TAG