Skip to content

Commit 45e51b7

Browse files
authored
Combined Window styles (#9425)
1 parent fef31ff commit 45e51b7

File tree

2 files changed

+8
-12
lines changed
  • src/Microsoft.DotNet.Wpf/src

2 files changed

+8
-12
lines changed

src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Window.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3583,14 +3583,7 @@ private void Initialize()
35833583
// TODO : Remove when Fluent theme is enabled by default
35843584
if (ThemeManager.IsFluentThemeEnabled)
35853585
{
3586-
if(WindowBackdropManager.IsBackdropEnabled)
3587-
{
3588-
SetResourceReference(StyleProperty, typeof(Window));
3589-
}
3590-
else
3591-
{
3592-
SetResourceReference(StyleProperty, "BackdropDisabledWindowStyle");
3593-
}
3586+
SetResourceReference(StyleProperty, typeof(Window));
35943587
}
35953588
}
35963589

src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/Window.xaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<ResourceDictionary
99
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
1010
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
11+
xmlns:framework="clr-namespace:MS.Internal;assembly=PresentationFramework"
1112
xmlns:controls="clr-namespace:Fluent.Controls">
1213

1314
<ControlTemplate x:Key="WindowTemplateKey"
@@ -71,13 +72,15 @@
7172
<Setter Property="Template"
7273
Value="{StaticResource WindowTemplateKey}"/>
7374
</Trigger>
75+
<DataTrigger Binding="{Binding Path=(SystemParameters.HighContrast)}" Value="True">
76+
<Setter Property="Background" Value="{DynamicResource WindowBackground}" />
77+
</DataTrigger>
78+
<DataTrigger Binding="{Binding Path=(framework:FrameworkAppContextSwitches.DisableFluentThemeWindowBackdrop)}" Value="True">
79+
<Setter Property="Background" Value="{DynamicResource WindowBackground}" />
80+
</DataTrigger>
7481
</Style.Triggers>
7582
</Style>
7683

77-
<Style x:Key="BackdropDisabledWindowStyle" BasedOn="{StaticResource DefaultWindowStyle}" TargetType="{x:Type Window}" >
78-
<Setter Property="Background" Value="{DynamicResource WindowBackground}" />
79-
</Style>
80-
8184
<Style BasedOn="{StaticResource DefaultWindowStyle}" TargetType="{x:Type Window}" />
8285

8386
</ResourceDictionary>

0 commit comments

Comments
 (0)