Skip to content

Commit

Permalink
Do something to #84
Browse files Browse the repository at this point in the history
  • Loading branch information
NotYoojun committed Aug 19, 2024
1 parent 081a3a6 commit c6d42ed
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
6 changes: 6 additions & 0 deletions samples/WpfApp1/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,11 @@
<ui:ToggleSwitch />
</ui:SettingsCard>

<RichTextBox HorizontalAlignment="Left" Height="62" VerticalAlignment="Top" Width="150" Canvas.Left="446" Canvas.Top="179"
BorderThickness="0">
<FrameworkElement.Resources>
<Thickness x:Key="{x:Static ui:ThemeKeys.TextControlBorderThemeThicknessFocusedKey}"></Thickness>
</FrameworkElement.Resources>
</RichTextBox>
</Canvas>
</Window>
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace iNKORE.UI.WPF.Modern.Gallery.SamplePages
public partial class SampleSystemBackdropsWindow : Window
{
BackdropType m_currentBackdrop => WindowHelper.GetSystemBackdropType(this);
bool m_useAcrylicBackdrop => WindowHelper.GetUseAcrylicBackdrop(this);
bool m_useAcrylicBackdrop => WindowHelper.GetSystemBackdropType(this) == BackdropType.Acrylic;
bool m_useAeroBackdrop => WindowHelper.GetUseAeroBackdrop(this);

public SampleSystemBackdropsWindow()
Expand All @@ -51,7 +51,7 @@ void ChangeBackdropButton_Click(object sender, RoutedEventArgs e)
}
else if (OSVersionHelper.IsWindows10OrGreater)
{
WindowHelper.SetUseAcrylicBackdrop(this, !m_useAcrylicBackdrop);
WindowHelper.SetSystemBackdropType(this, m_useAcrylicBackdrop ? BackdropType.Acrylic : BackdropType.None);
}
else if (OSVersionHelper.IsWindowsVistaOrGreater)
{
Expand Down
16 changes: 8 additions & 8 deletions source/iNKORE.UI.WPF.Modern/Helpers/Styles/BackdropHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ public static bool Apply(IntPtr handle, BackdropType type, bool force = false, C
if (handle == IntPtr.Zero) { return false; }

// Fixes from: https://github.com/iNKORE-NET/UI.WPF.Modern/pull/63
//var captionColor = -2; //DWMWA_COLOR_NONE - 0xFFFFFFFE
//DWMAPI.DwmSetWindowAttribute(handle, DWMAPI.DWMWINDOWATTRIBUTE.DWMWA_CAPTION_COLOR,
// ref captionColor,
// Marshal.SizeOf(typeof(int)));
var captionColor = -2; //DWMWA_COLOR_NONE - 0xFFFFFFFE
DWMAPI.DwmSetWindowAttribute(handle, DWMAPI.DWMWINDOWATTRIBUTE.DWMWA_CAPTION_COLOR,
ref captionColor,
Marshal.SizeOf(typeof(int)));

return type switch
{
Expand Down Expand Up @@ -158,10 +158,10 @@ public static void Remove(IntPtr handle)
Marshal.SizeOf(typeof(int)));

// Fixes from: https://github.com/iNKORE-NET/UI.WPF.Modern/pull/63
//var captionColor = -1; //DWMWA_COLOR_DEFAULT - 0xFFFFFFFF
//DWMAPI.DwmSetWindowAttribute(handle, DWMAPI.DWMWINDOWATTRIBUTE.DWMWA_CAPTION_COLOR,
// ref captionColor,
// Marshal.SizeOf(typeof(int)));
var captionColor = -1; //DWMWA_COLOR_DEFAULT - 0xFFFFFFFF
DWMAPI.DwmSetWindowAttribute(handle, DWMAPI.DWMWINDOWATTRIBUTE.DWMWA_CAPTION_COLOR,
ref captionColor,
Marshal.SizeOf(typeof(int)));
}

/// <summary>
Expand Down

0 comments on commit c6d42ed

Please sign in to comment.