Added WindowStyle

This commit is contained in:
Dan Clark
2024-11-03 18:28:44 +00:00
parent e53100de13
commit 9a566f33fd
4 changed files with 69 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>Toolkit.UI.WinUI</RootNamespace>
<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &gt;= 8">
win-x86;win-x64;win-arm64
</RuntimeIdentifiers>
<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) &lt; 8">
win10-x86;win10-x64;win10-arm64
</RuntimeIdentifiers>
<UseWinUI>true</UseWinUI>
<WindowsSdkPackageVersion>10.0.19041.41</WindowsSdkPackageVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.240923002" />
<PackageReference Include="WinUIEx" Version="2.4.2" />
</ItemGroup>
</Project>
+25
View File
@@ -0,0 +1,25 @@
using Microsoft.UI.Xaml;
using WinUIEx;
namespace Toolkit.UI.WinUI;
public static partial class WindowExtensions
{
public static void SetWindowStyle(this Window window,
WindowStyle style)
{
WinUIEx.WindowStyle windowStyle = window.GetWindowStyle();
switch (style)
{
case WindowStyle.None:
windowStyle &= ~(WinUIEx.WindowStyle.Caption |
WinUIEx.WindowStyle.ThickFrame |
WinUIEx.WindowStyle.Border |
WinUIEx.WindowStyle.SysMenu);
break;
}
window.SetWindowStyle(windowStyle);
}
}
+9
View File
@@ -0,0 +1,9 @@
namespace Toolkit.UI.WinUI;
public enum WindowStyle
{
None,
SingleBorderWindow,
ThreeDBorderWindow,
ToolWindow
}