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.
Commentaires
https://aka.ms/ContentUserFeedback.
Bientôt disponible : Tout au long de 2024, nous allons supprimer progressivement GitHub Issues comme mécanisme de commentaires pour le contenu et le remplacer par un nouveau système de commentaires. Pour plus d’informations, consultezEnvoyer et afficher des commentaires pour