update dotnet 9.0 windowsappsdk experimental2 add app titlebar
This commit is contained in:
1 parent
e734d89fb3
commit
33c0a002a2
6 files changed
+61
-39
No files matched your search
@@ -1,5 +1,6 @@
|
||||
<Page
|
||||
x:Class="GZStudio.Views.ShellPage"
|
||||
xmlns:controls="using:CommunityToolkit.WinUI.Controls"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
@@ -10,39 +11,32 @@
|
||||
Loaded="OnLoaded">
|
||||
|
||||
<Grid>
|
||||
<Grid x:Name="AppTitleBar"
|
||||
Canvas.ZIndex="1"
|
||||
Height="{Binding ElementName=NavigationViewControl, Path=CompactPaneLength}"
|
||||
IsHitTestVisible="True"
|
||||
VerticalAlignment="Top">
|
||||
<Image Source="/Assets/WindowIcon.ico"
|
||||
HorizontalAlignment="Left"
|
||||
Width="16"
|
||||
Height="16" />
|
||||
<TextBlock x:Name="AppTitleBarText"
|
||||
VerticalAlignment="Center"
|
||||
TextWrapping="NoWrap"
|
||||
Style="{StaticResource CaptionTextBlockStyle}"
|
||||
Margin="28,0,0,0"/>
|
||||
</Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<TitleBar x:Name="AppTitleBar" Title="GZStudio" Subtitle="preview" IsBackButtonVisible="True" IsPaneToggleButtonVisible="True" BorderBrush="WhiteSmoke" BorderThickness="2" CornerRadius="3"></TitleBar>
|
||||
<NavigationView
|
||||
Grid.Row="1"
|
||||
x:Name="NavigationViewControl"
|
||||
IsPaneToggleButtonVisible="False"
|
||||
Canvas.ZIndex="0"
|
||||
IsBackButtonVisible="Visible"
|
||||
IsBackButtonVisible="Collapsed"
|
||||
IsBackEnabled="{x:Bind ViewModel.IsBackEnabled, Mode=OneWay}"
|
||||
SelectedItem="{x:Bind ViewModel.Selected, Mode=OneWay}"
|
||||
IsSettingsVisible="True"
|
||||
ExpandedModeThresholdWidth="1280"
|
||||
DisplayModeChanged="NavigationViewControl_DisplayModeChanged"
|
||||
Header="{x:Bind ((ContentControl)ViewModel.Selected).Content, Mode=OneWay}">
|
||||
|
||||
<NavigationView.MenuItems>
|
||||
<!--
|
||||
TODO: Update item titles by updating <x:Uid>.Content entries in Strings/en-us/Resources.resw.
|
||||
https://docs.microsoft.com/windows/uwp/app-resources/localize-strings-ui-manifest#refer-to-a-string-resource-identifier-from-xaml
|
||||
TODO: Update item titles by updating <x:Uid>.Content entries in Strings/en-us/Resources.resw.
|
||||
https://docs.microsoft.com/windows/uwp/app-resources/localize-strings-ui-manifest#refer-to-a-string-resource-identifier-from-xaml
|
||||
|
||||
TODO: Update item icons by updating FontIcon.Glyph properties.
|
||||
https://docs.microsoft.com/windows/apps/design/style/segoe-fluent-icons-font#icon-list
|
||||
-->
|
||||
TODO: Update item icons by updating FontIcon.Glyph properties.
|
||||
https://docs.microsoft.com/windows/apps/design/style/segoe-fluent-icons-font#icon-list
|
||||
-->
|
||||
<NavigationViewItem x:Uid="Shell_AppList" helpers:NavigationHelper.NavigateTo="GZStudio.ViewModels.AppListViewModel">
|
||||
<NavigationViewItem.Icon>
|
||||
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}" Glyph=""/>
|
||||
@@ -58,20 +52,20 @@
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<TextBlock
|
||||
Text="{Binding}"
|
||||
Style="{ThemeResource TitleTextBlockStyle}" />
|
||||
Text="{Binding}"
|
||||
Style="{ThemeResource TitleTextBlockStyle}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</NavigationView.HeaderTemplate>
|
||||
<i:Interaction.Behaviors>
|
||||
<behaviors:NavigationViewHeaderBehavior
|
||||
DefaultHeader="{x:Bind ((ContentControl)ViewModel.Selected).Content, Mode=OneWay}">
|
||||
DefaultHeader="{x:Bind ((ContentControl)ViewModel.Selected).Content, Mode=OneWay}">
|
||||
<behaviors:NavigationViewHeaderBehavior.DefaultHeaderTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<TextBlock
|
||||
Text="{Binding}"
|
||||
Style="{ThemeResource TitleTextBlockStyle}" />
|
||||
Text="{Binding}"
|
||||
Style="{ThemeResource TitleTextBlockStyle}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</behaviors:NavigationViewHeaderBehavior.DefaultHeaderTemplate>
|
||||
|
||||
@@ -12,6 +12,8 @@ using Windows.System;
|
||||
namespace GZStudio.Views;
|
||||
|
||||
// TODO: Update NavigationViewItem titles and icons in ShellPage.xaml.
|
||||
|
||||
|
||||
public sealed partial class ShellPage : Page
|
||||
{
|
||||
public ShellViewModel ViewModel
|
||||
@@ -33,9 +35,22 @@ public sealed partial class ShellPage : Page
|
||||
App.MainWindow.ExtendsContentIntoTitleBar = true;
|
||||
App.MainWindow.SetTitleBar(AppTitleBar);
|
||||
App.MainWindow.Activated += MainWindow_Activated;
|
||||
AppTitleBarText.Text = "AppDisplayName".GetLocalized();
|
||||
//AppTitleBarText.Text = "AppDisplayName".GetLocalized();
|
||||
//AppTitleBar.Loaded += MyTitleBar_Loaded;
|
||||
}
|
||||
|
||||
//private void MyTitleBar_Loaded(object sender, RoutedEventArgs e)
|
||||
//{
|
||||
// // Parts get delay loaded. If you have the parts, make them visible.
|
||||
// VisualStateManager.GoToState(AppTitleBar, "SubtitleTextVisible", false);
|
||||
// VisualStateManager.GoToState(AppTitleBar, "HeaderVisible", false);
|
||||
// VisualStateManager.GoToState(AppTitleBar, "ContentVisible", false);
|
||||
// VisualStateManager.GoToState(AppTitleBar, "FooterVisible", false);
|
||||
|
||||
// // Run layout so we re-calculate the drag regions.
|
||||
// AppTitleBar.InvalidateMeasure();
|
||||
//}
|
||||
|
||||
private void OnLoaded(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
TitleBarHelper.UpdateTitleBar(RequestedTheme);
|
||||
@@ -46,18 +61,18 @@ public sealed partial class ShellPage : Page
|
||||
|
||||
private void MainWindow_Activated(object sender, WindowActivatedEventArgs args)
|
||||
{
|
||||
App.AppTitlebar = AppTitleBarText as UIElement;
|
||||
//App.AppTitlebar = AppTitleBarText as UIElement;
|
||||
}
|
||||
|
||||
private void NavigationViewControl_DisplayModeChanged(NavigationView sender, NavigationViewDisplayModeChangedEventArgs args)
|
||||
{
|
||||
AppTitleBar.Margin = new Thickness()
|
||||
{
|
||||
Left = sender.CompactPaneLength * (sender.DisplayMode == NavigationViewDisplayMode.Minimal ? 2 : 1),
|
||||
Top = AppTitleBar.Margin.Top,
|
||||
Right = AppTitleBar.Margin.Right,
|
||||
Bottom = AppTitleBar.Margin.Bottom
|
||||
};
|
||||
//AppTitleBar.Margin = new Thickness()
|
||||
//{
|
||||
// Left = sender.CompactPaneLength * (sender.DisplayMode == NavigationViewDisplayMode.Minimal ? 2 : 1),
|
||||
// Top = AppTitleBar.Margin.Top,
|
||||
// Right = AppTitleBar.Margin.Right,
|
||||
// Bottom = AppTitleBar.Margin.Bottom
|
||||
//};
|
||||
}
|
||||
|
||||
private static KeyboardAccelerator BuildKeyboardAccelerator(VirtualKey key, VirtualKeyModifiers? modifiers = null)
|
||||
|
||||
Reference in new issue
Block a user