精简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 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 # All files
[*] [*]
indent_style = space 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="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:MyApp"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:winex="using:WinUIEx" xmlns:winex="using:WinUIEx"
Title="MainWindow"
mc:Ignorable="d"> mc:Ignorable="d">
<Window.SystemBackdrop> <Window.SystemBackdrop>
<MicaBackdrop /> <MicaBackdrop />
</Window.SystemBackdrop> </Window.SystemBackdrop>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock>Pure WinUI3</TextBlock> <Grid>
<TextBlock>None</TextBlock> <Grid.RowDefinitions>
</StackPanel> <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> </winex:WindowEx>

View File

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

View File

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