■ LinearGradientBrush 엘리먼트를 사용하는 방법을 보여준다.
▶ 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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
<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> |