Make AbstractUIGroupDialog title bar dark

This commit is contained in:
Yoshi Askharoun
2024-05-17 22:09:19 -05:00
parent 3591c5363e
commit c5ef6e397f
3 changed files with 24 additions and 1 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
xmlns:local="clr-namespace:ZuneModdingHelper"
xmlns:absui="clr-namespace:OwlCore.Wpf.AbstractUI.Controls;assembly=OwlCore.Wpf"
mc:Ignorable="d"
Title="Options" Height="475" Width="800"
Title="Options" Height="400" Width="700"
WindowStartupLocation="CenterScreen"
Foreground="White">
<Window.Resources>
@@ -1,6 +1,9 @@
using OwlCore.AbstractUI.Models;
using OwlCore.AbstractUI.ViewModels;
using System.Runtime.InteropServices;
using System;
using System.Windows;
using System.Windows.Interop;
namespace ZuneModdingHelper
{
@@ -9,6 +12,25 @@ namespace ZuneModdingHelper
/// </summary>
public partial class AbstractUIGroupDialog : Window
{
[LibraryImport("DwmApi")]
private static partial int DwmSetWindowAttribute(IntPtr hwnd, int attr, int[] attrValue, int attrSize);
protected override void OnSourceInitialized(EventArgs e)
{
base.OnSourceInitialized(e);
// TODO: Move this entire control into a proper dialog.
var isAtLeastWin10 = Environment.OSVersion.Version > new Version(10, 0);
if (isAtLeastWin10)
{
var handle = new WindowInteropHelper(this).EnsureHandle();
if (DwmSetWindowAttribute(handle, 19, [1], 4) != 0)
_ = DwmSetWindowAttribute(handle, 20, [1], 4);
}
}
public AbstractUIGroupDialog(AbstractUICollectionViewModel viewModel)
{
ViewModel = viewModel;
@@ -12,6 +12,7 @@
<Platforms>x64;x86</Platforms>
<LangVersion>latest</LangVersion>
<ApplicationIcon>Assets\ZMH_Icon.ico</ApplicationIcon>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>