Added WindowStyle
This commit is contained in:
@@ -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)')) >= 8">
|
||||
win-x86;win-x64;win-arm64
|
||||
</RuntimeIdentifiers>
|
||||
<RuntimeIdentifiers Condition="$([MSBuild]::GetTargetFrameworkVersion('$(TargetFramework)')) < 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>
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Toolkit.UI.WinUI;
|
||||
|
||||
public enum WindowStyle
|
||||
{
|
||||
None,
|
||||
SingleBorderWindow,
|
||||
ThreeDBorderWindow,
|
||||
ToolWindow
|
||||
}
|
||||
Reference in New Issue
Block a user