You'll have to use the Window.SetTitleBar
method to achieve your desired behavior. Therefore, you'll need to accomplish a few steps:
First, enable the view to extend into the title bar. Please note, that you can only set the left part of the title bar. The Minimize, Maximize and Close buttons will still be there:
CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
After you have set that, you call the Window.SetTitleBar
method with an UIElement
:
Window.Current.SetTitleBar(myTitleBar);
Where as myTitleBar
could look like this:
<Border x:Name="myTitleBar">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- Title -->
<TextBlock Grid.Column="0"
Text="..."/>
<!-- Custom buttons attached to the right side -->
<StackPanel Grid.Column="1"
Orientation="Horizontal">
<Button x:Name="FullScreenButton"/>
<!-- Use U+E740 FullScreen Icon for the button above -->
</StackPanel>
</Grid>
</Border
An extended guide by Marco Minerva (including a nice XAML behavior that will tweak this use-case even better) can be found here.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…