■ Style 엘리먼트 : TargetType 속성 사용하기

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

<StackPanel

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

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

    <StackPanel.Resources>

        <Style TargetType="{x:Type Button}">

            <Setter Property="FontSize"   Value="24"   />

            <Setter Property="Foreground" Value="Blue" />

        </Style>

        <Style TargetType="{x:Type TextBlock}">

            <Setter Property="Foreground" Value="Red" />

        </Style>

    </StackPanel.Resources>

    <Button>텍스트를 갖는 버튼</Button>

    <TextBlock>텍스트 블럭 텍스트</TextBlock>

    <Button>

        <TextBlock>텍스트 블럭 내용을 갖는 버튼</TextBlock>

    </Button>

</StackPanel>

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

Posted by 사용자 icodebroker
TAG