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

■ LinearGradientBrush 엘리먼트를 사용하는 방법을 보여준다.

TestProject.zip
0.01MB

▶ 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="LinearGradientBrush 엘리먼트 사용하기"
    Background="#ff000000"
    FontFamily="나눔고딕코딩"
    FontSize="16">
    <Window.Resources>
        <LinearGradientBrush x:Key="BackLinearGradientBrushKey"
            StartPoint="0.5 0"
            EndPoint="0.5 1">
            <GradientStop Offset="0"     Color="#ff747474" />
            <GradientStop Offset="1"     Color="#ff292929" />
            <GradientStop Offset="0.536" Color="#ff3d3d3d" />
        </LinearGradientBrush>
    </Window.Resources>
    <Grid Name="rootGrid"
        Margin="2">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="250"  />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*"    />
        </Grid.ColumnDefinitions>
        <Grid Grid.Column="0"
            VerticalAlignment="Stretch"
            Margin="2 2 2 2"
            Height="Auto">
            <Grid.RowDefinitions>
                <RowDefinition Height="30" />
                <RowDefinition Height="*"  />
                <RowDefinition Height="30" />
            </Grid.RowDefinitions>
            <Border Grid.Row="0"
                Margin="0 0 0 0"
                Width="Auto"
                BorderThickness="0 1 1 0"
                BorderBrush="#ffb1b1b1"
                CornerRadius="0 4 0 0"
                Background="{DynamicResource BackLinearGradientBrushKey}">
                <Menu
                    VerticalAlignment="Center"
                    Margin="2 1 2 1"
                    Width="Auto"
                    Height="Auto"
                    Background="{x:Null}"
                    Foreground="{x:Null}">
                    <MenuItem Header="메뉴 1"
                        Foreground="#ffffffff">
                        <MenuItem Header="메뉴 2"
                            InputGestureText="Ctrl+L"
                            Foreground="Black"/>
                        <MenuItem Header="메뉴 3"
                            InputGestureText="Ctrl+A"
                            Foreground="Black">
                            <MenuItem.Icon>
                                <Ellipse
                                    Width="16"
                                    Height="16"
                                    Fill="LightBlue" />
                            </MenuItem.Icon>
                        </MenuItem>
                        <MenuItem Header="메뉴 4"
                            Foreground="Black" />
                        <Separator />
                        <MenuItem Header="메뉴 5"
                            Foreground="Black">
                            <MenuItem Header="메뉴 6" />
                            <MenuItem Header="메뉴 7" />
                            <MenuItem Header="메뉴 8" />
                        </MenuItem>
                        <MenuItem Header="메뉴 9"
                            Foreground="Black" />
                    </MenuItem>
                    <MenuItem Header="메뉴 10"
                        Foreground="#ffffffff">
                        <MenuItem Header="메뉴 11"
                            Foreground="Black" />
                        <MenuItem Header="메뉴 12 (체크 가능)"
                            Foreground="Black"
                            IsCheckable="True" />
                        <MenuItem Header="메뉴 13"
                            Foreground="Black" />
                        <Separator />
                        <MenuItem Header="메뉴 14"
                            Foreground="Black">
                            <MenuItem Header="메뉴 15" />
                            <MenuItem Header="메뉴 16" />
                            <MenuItem Header="메뉴 17" />
                        </MenuItem>
                        <MenuItem Header="메뉴 18"
                            Foreground="Black" />
                    </MenuItem>
                    <MenuItem Header="메뉴 18"
                        Foreground="#ffffffff" >
                        <MenuItem Header="메뉴 19"
                            Foreground="Black" />
                        <MenuItem Header="메뉴 20"
                            Foreground="Black" />
                        <MenuItem Header="메뉴 21"
                            Foreground="Black" />
                        <Separator />
                        <MenuItem Header="메뉴 22"
                            Foreground="Black" />
                    </MenuItem>
                </Menu>
            </Border>
            <Border Grid.Row="1"
                Margin="0 0 0 0"
                Width="Auto"
                BorderThickness="0 0 1 0"
                BorderBrush="#ffb1b1b1"
                Background="{DynamicResource BackLinearGradientBrushKey}" />
            <Border Grid.Row="2"
                Margin="0 0 0 0"
                BorderThickness="0 1 1 1"
                BorderBrush="#ffb1b1b1"
                CornerRadius="0 0 4 0"
                Background="{DynamicResource BackLinearGradientBrushKey}" />
        </Grid>
        <GridSplitter Grid.Column="1"
            VerticalAlignment="Stretch"
            Width="2"
            Background="#ff000000"
            ResizeBehavior="PreviousAndNext" />
        <Grid Grid.Column="2"
            Margin="0 2 0 2"
            Background="{x:Null}">
            <Grid.RowDefinitions>
                <RowDefinition Height="30"   />
                <RowDefinition Height="*"    />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*"    />
            </Grid.RowDefinitions>
            <Border Grid.Row="0"
                Margin="0 0 0 0"
                Width="Auto"
                BorderThickness="0 1 1 0"
                BorderBrush="#ffb1b1b1"
                CornerRadius="4 0 0 0"
                Background="{DynamicResource BackLinearGradientBrushKey}" />
            <ScrollViewer Grid.Row="1"
                Margin="0 0 0 4"
                Background="#ffffffff"
                HorizontalScrollBarVisibility="Auto">
                <Canvas
                    Width="500"
                    Height="500" />
            </ScrollViewer>
            <GridSplitter Grid.Row="2"
                HorizontalAlignment="Stretch"
                VerticalAlignment="Bottom"
                Height="2"
                Background="#ff000000"
                ResizeBehavior="PreviousAndNext" />
            <ScrollViewer Grid.Row="3"
                Margin="0 0 0 0"
                HorizontalScrollBarVisibility="Auto"
                Background="#ffffffff">
                <Canvas
                    Width="500"
                    Height="500" />
            </ScrollViewer>
        </Grid>
    </Grid>
</Window>
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요