■ BulletDecorator 엘리먼트에서 Ellipse 엘리먼트를 불릿으로 사용하는 방법을 보여준다.
▶ MainWindow.xaml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
<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> |