diff --git a/src/SamplesApp/SamplesApp.UnitTests.Shared/Controls/UITests/Presentation/SampleChooserViewMode.Properties.cs b/src/SamplesApp/SamplesApp.UnitTests.Shared/Controls/UITests/Presentation/SampleChooserViewMode.Properties.cs
index f7dc81439419..9f9e23e8f836 100644
--- a/src/SamplesApp/SamplesApp.UnitTests.Shared/Controls/UITests/Presentation/SampleChooserViewMode.Properties.cs
+++ b/src/SamplesApp/SamplesApp.UnitTests.Shared/Controls/UITests/Presentation/SampleChooserViewMode.Properties.cs
@@ -53,6 +53,7 @@ public partial class SampleChooserViewModel : System.ComponentModel.INotifyPrope
private bool _isAnyContentVisible = false;
private bool _contentAttachedToWindow;
private bool _useFluentStyles;
+ private bool _useDarkTheme;
private object _contentPhone = null;
private string _searchTerm = "";
@@ -410,6 +411,7 @@ public bool UseFluentStyles
Application.Current.Resources.MergedDictionaries.Remove(_fluentResources);
}
#if HAS_UNO
+ // Force the in app styles to reload
Application.Current.Resources?.UpdateThemeBindings();
Uno.UI.ResourceResolver.UpdateSystemThemeBindings();
Application.PropagateThemeChanged(Windows.UI.Xaml.Window.Current.Content);
@@ -418,6 +420,20 @@ public bool UseFluentStyles
}
}
+ public bool UseDarkTheme
+ {
+ get => _useDarkTheme;
+ set
+ {
+ _useDarkTheme = value;
+ if (Windows.UI.Xaml.Window.Current.Content is FrameworkElement root)
+ {
+ root.RequestedTheme = _useDarkTheme ? ElementTheme.Dark : ElementTheme.Light;
+ }
+ RaisePropertyChanged();
+ }
+ }
+
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
}
}
diff --git a/src/SamplesApp/SamplesApp.UnitTests.Shared/Controls/UITests/Views/Controls/SampleChooserControl.xaml b/src/SamplesApp/SamplesApp.UnitTests.Shared/Controls/UITests/Views/Controls/SampleChooserControl.xaml
index 9a0cdb924ec0..f547678abf14 100644
--- a/src/SamplesApp/SamplesApp.UnitTests.Shared/Controls/UITests/Views/Controls/SampleChooserControl.xaml
+++ b/src/SamplesApp/SamplesApp.UnitTests.Shared/Controls/UITests/Views/Controls/SampleChooserControl.xaml
@@ -49,7 +49,7 @@
+ Value="{StaticResource ApplicationPageBackgroundThemeBrush}" />
@@ -252,7 +252,7 @@
-
@@ -339,7 +339,7 @@
ContentTemplate="{StaticResource SearchList}" />
-
+
@@ -530,6 +531,11 @@
Grid.Column="8"
IsChecked="{Binding UseFluentStyles, Mode=TwoWay}"
Style="{x:Null}"/>
+
+
+
+