■ Style 엘리먼트 : TargetType 속성을 사용해 Button 스타일 설정하기

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

 

...

<StackPanel Margin="10">

    <StackPanel.Resources>

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

            <Setter Property="Margin"      Value="10"      />

            <Setter Property="BorderBrush" Value="Crimson" />

            <Setter Property="Background" Value="Orange"   />

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

            <Setter Property="FontWeight" Value="Bold"     />

        </Style>

    </StackPanel.Resources>

    <Button>Click Me!</Button>

    <Label

        Margin="10"

        FontSize="20">

        Don't Click Me!

    </Label>

    <Button>Click Me!</Button>

</StackPanel>

...

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

Posted by 사용자 icodebroker
TAG

댓글을 달아 주세요