View extensions

The ApplicationViewExtensions and TitleBarExtensions provide a declarative way of setting ApplicationView, CoreApplicationView and ApplicationViewTitleBar properties from XAML.

Platform APIs: ApplicationViewExtensions, TitleBarExtensions

Example

These attached properties all target a Page element, so they can be used directly from XAML when declaring a control of this type in an application:

<Page x:Class="Microsoft.Toolkit.Uwp.SampleApp.SamplePages.ViewExtensionsPage"
      xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:d="https://schemas.microsoft.com/expression/blend/2008"
      xmlns:local="using:Microsoft.Toolkit.Uwp.SampleApp.SamplePages"
      xmlns:mc="https://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:ui="using:Microsoft.Toolkit.Uwp.UI"
      ui:ApplicationViewExtensions.Title="View Extensions"
      ui:ApplicationViewExtensions.ExtendViewIntoTitleBar="True"
      ui:TitleBarExtensions.BackgroundColor="Gray"
      ui:TitleBarExtensions.ButtonBackgroundColor="Orange"
      ui:TitleBarExtensions.ButtonForegroundColor="Black"
      ui:TitleBarExtensions.ButtonHoverBackgroundColor="DarkOrange"
      ui:TitleBarExtensions.ButtonHoverForegroundColor="Gray"
      ui:TitleBarExtensions.ButtonPressedForegroundColor="DarkGray"
      mc:Ignorable="d">

    <!-- Page content here -->
</Page>

Examples

You can find more examples in the unit tests.