첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170

■ BulletDecorator 엘리먼트에서 Ellipse 엘리먼트를 불릿으로 사용하는 방법을 보여준다.

TestProject.zip
다운로드

▶ MainWindow.xaml

<Window x:Class="TestProject.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Width="800"
    Height="600"
    Title="BulletDecorator 엘리먼트 사용하기"
    FontFamily="나눔고딕코딩"
    FontSize="16">
    <Window.Resources>
        <Style TargetType="{x:Type BulletDecorator}">
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="Margin"            Value="10"     />
        </Style>
        <Style x:Key="BulletRectangleKey" TargetType="{x:Type Ellipse}">
            <Setter Property="Width"  Value="12"         />
            <Setter Property="Height" Value="12"         />
            <Setter Property="Stroke" Value="DarkGray"   />
            <Setter Property="StrokeThickness" Value="1" />
            <Setter Property="Fill">
                <Setter.Value>
                    <LinearGradientBrush
                        StartPoint="0 0"
                        EndPoint="1 1">
                        <GradientStop Offset="0"   Color="Blue"  />
                        <GradientStop Offset="0.5" Color="White" />
                        <GradientStop Offset="1"   Color="Blue"  />
                    </LinearGradientBrush>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="BulletTextBlockKey" TargetType="{x:Type TextBlock}">
            <Setter Property="Margin"              Value="10 0 0 0" />
            <Setter Property="HorizontalAlignment" Value="Left"     />
        </Style>
    </Window.Resources>
    <Grid>
        <StackPanel
            HorizontalAlignment="Center"
            VerticalAlignment="Center">
            <BulletDecorator>
                <BulletDecorator.Bullet>
                    <Ellipse Style="{StaticResource BulletRectangleKey}" />
                </BulletDecorator.Bullet>
                <TextBlock Style="{StaticResource BulletTextBlockKey}">항목 1</TextBlock>
            </BulletDecorator>
            <BulletDecorator>
                <BulletDecorator.Bullet>
                    <Ellipse Style="{StaticResource BulletRectangleKey}" />
                </BulletDecorator.Bullet>
                <TextBlock Style="{StaticResource BulletTextBlockKey}">항목 2</TextBlock>
            </BulletDecorator>
            <BulletDecorator>
                <BulletDecorator.Bullet>
                    <Ellipse Style="{StaticResource BulletRectangleKey}" />
                </BulletDecorator.Bullet>
                <TextBlock Style="{StaticResource BulletTextBlockKey}">항목 3</TextBlock>
            </BulletDecorator>
            <BulletDecorator>
                <BulletDecorator.Bullet>
                    <Ellipse Style="{StaticResource BulletRectangleKey}" />
                </BulletDecorator.Bullet>
                <TextBlock Style="{StaticResource BulletTextBlockKey}">항목 4</TextBlock>
            </BulletDecorator>
            <BulletDecorator>
                <BulletDecorator.Bullet>
                    <Ellipse Style="{StaticResource BulletRectangleKey}" />
                </BulletDecorator.Bullet>
                <TextBlock Style="{StaticResource BulletTextBlockKey}">항목 5</TextBlock>
            </BulletDecorator>
        </StackPanel>
    </Grid>
</Window>
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요