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

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

<Canvas

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

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

    <Canvas.Resources>

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

            <Setter Property="Width"           Value="96"    />

            <Setter Property="Height"          Value="96"    />

            <Setter Property="Stroke"          Value="Black" />

            <Setter Property="StrokeThickness" Value="3"     />

        </Style>

    </Canvas.Resources>

    <Ellipse Canvas.Left="100" Canvas.Top="50" Fill="Blue"    />

    <Ellipse Canvas.Left="150" Canvas.Top="100" Fill="Red"     />

    <Ellipse Canvas.Left="200" Canvas.Top="150" Fill="Green"   />

    <Ellipse Canvas.Left="250" Canvas.Top="100" Fill="Cyan"    />

    <Ellipse Canvas.Left="300" Canvas.Top="50" Fill="Magenta" />

</Canvas>

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

Posted by 사용자 icodebroker
TAG