File tree 2 files changed +12
-0
lines changed
src/System.Windows.Forms/System/Windows/Forms
2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -162,6 +162,7 @@ public unsafe partial class Control :
162
162
internal const string ExplorerThemeIdentifier = "Explorer" ;
163
163
internal const string ItemsViewThemeIdentifier = "ItemsView" ;
164
164
internal const string ComboBoxButtonThemeIdentifier = "CFD" ;
165
+ internal const string BannerContainerThemeIdentifier = "FileExplorerBannerContainer" ;
165
166
166
167
private const short PaintLayerBackground = 1 ;
167
168
private const short PaintLayerForeground = 2 ;
Original file line number Diff line number Diff line change @@ -1289,6 +1289,14 @@ protected override void OnHandleCreated(EventArgs e)
1289
1289
}
1290
1290
1291
1291
UpdateTabSelection ( false ) ;
1292
+
1293
+ #pragma warning disable WFO5001
1294
+ if ( Application . IsDarkModeEnabled )
1295
+ {
1296
+ PInvoke . SetWindowTheme ( HWND , null , $ "{ DarkModeIdentifier } ::{ BannerContainerThemeIdentifier } ") ;
1297
+ PInvokeCore . EnumChildWindows ( this , StyleUpDown ) ;
1298
+ }
1299
+ #pragma warning restore WFO5001
1292
1300
}
1293
1301
1294
1302
protected override void OnHandleDestroyed ( EventArgs e )
@@ -1771,6 +1779,9 @@ private bool ShouldSerializeItemSize()
1771
1779
return ! _padding . Equals ( s_defaultPaddingPoint ) ;
1772
1780
}
1773
1781
1782
+ private BOOL StyleUpDown ( HWND handle )
1783
+ => PInvoke . SetWindowTheme ( handle , $ "{ DarkModeIdentifier } _{ ExplorerThemeIdentifier } ", null ) . Succeeded ;
1784
+
1774
1785
/// <summary>
1775
1786
/// Returns a string representation for this control.
1776
1787
/// </summary>
You can’t perform that action at this time.
0 commit comments