精简manifest引用,自定义titlebar

This commit is contained in:
Steven Hobs
2026-02-13 00:13:27 +08:00
parent b03db7ac51
commit 5904b03264
7 changed files with 22 additions and 13 deletions

View File

@@ -1,5 +1,10 @@
root = true
# Workaround for https://github.com/microsoft/microsoft-ui-xaml/issues/10855
[XamlTypeInfo.g.cs]
dotnet_diagnostic.CS0612.severity = none
dotnet_diagnostic.CS0618.severity = none
# All files
[*]
indent_style = space

BIN
Assets/Logo/app_128.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

BIN
Assets/Logo/app_64.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
Assets/Logo/app_64.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 991 B

View File

@@ -4,15 +4,23 @@
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"
xmlns:local="using:MyApp"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:winex="using:WinUIEx"
Title="MainWindow"
mc:Ignorable="d">
<Window.SystemBackdrop>
<MicaBackdrop />
</Window.SystemBackdrop>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock>Pure WinUI3</TextBlock>
<TextBlock>None</TextBlock>
</StackPanel>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TitleBar x:Name="AppTitleBar" Title="{x:Bind Title}">
<TitleBar.IconSource>
<ImageIconSource ImageSource="/Assets/Logo/app_64.png" />
</TitleBar.IconSource>
</TitleBar>
</Grid>
</winex:WindowEx>

View File

@@ -5,10 +5,9 @@ public sealed partial class MainWindow : WindowEx
{
public MainWindow()
{
this.InitializeComponent();
this.SetIcon("Assets/Logo/app.ico");
Title = "Pure";
Width = 600;
Height = 480;
InitializeComponent();
this.SetIcon("Assets/Logo/app_64.ico");
ExtendsContentIntoTitleBar = true;
SetTitleBar(AppTitleBar);
}
}

View File

@@ -27,7 +27,4 @@
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.8.260209005" />
<PackageReference Include="WinUIEx" Version="2.9.0" />
</ItemGroup>
<ItemGroup>
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>
</Project>