■ Window 클래스의 ExtendsContentIntoTitleBar 속성/SetTitleBar 메소드를 사용해 컨텐트를 타이틀바까지 확장하는 방법을 보여준다.
▶ MainWindow.xaml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<?xml version="1.0" encoding="utf-8"?> <Window x:Class="TestProject.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="TestProject"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="32" /> <RowDefinition Height="*" /> </Grid.RowDefinitions> <Grid Name="titleGrid" Grid.Row="0" Background="Red" /> <Ellipse Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="30" Fill="RoyalBlue" /> </Grid> </Window> |
▶ MainWindow.xaml.cs
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 |
using Microsoft.UI.Xaml; namespace TestProject { /// <summary> /// 메인 윈도우 /// </summary> public sealed partial class MainWindow : Window { //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor ////////////////////////////////////////////////////////////////////////////////////////// Public #region 생성자 - MainWindow() /// <summary> /// 생성자 /// </summary> public MainWindow() { InitializeComponent(); ExtendsContentIntoTitleBar = true; SetTitleBar(this.titleGrid); } #endregion } } |