728x90
반응형
728x170
■ LinearGradientBrush 엘리먼트를 사용하는 방법을 보여준다.
▶ 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
반응형
그리드형(광고전용)
'C# > WPF' 카테고리의 다른 글
[C#/WPF] Adorner 클래스 : 슬라이딩 어도너 사용하기 (0) | 2021.09.13 |
---|---|
[C#/WPF] UserControl 클래스 : 로딩 패널 사용하기 (0) | 2021.09.11 |
[C#/WPF] ImageAwesome 엘리먼트 : Spin/SpinDuration 속성을 사용해 아이콘 회전시키기 (0) | 2021.09.11 |
[C#/WPF] 누겟 설치 : FontAwesome.WPF (0) | 2021.09.11 |
[C#/WPF] GOM 플레이어 모방하기 (0) | 2021.09.05 |
[C#/WPF] Vector 구조체 : 각도에서 벡터 구하기 (0) | 2021.08.20 |
[C#/WPF] Window 클래스 : 커스텀 윈도우 사용하기 (0) | 2021.08.20 |
[C#/WPF] Application 클래스 : Restart 메소드를 사용해 애플리케이션 재시작하기 (0) | 2021.08.19 |
[C#/WPF] Vector 구조체 : 벡터 각도 구하기 (0) | 2021.08.19 |
[C#/WPF] ResourceDictionary 클래스 : MergedDictionaries 속성을 사용해 Application 객체의 리소스 사용하기 (0) | 2021.07.08 |
댓글을 달아 주세요