Ensure the flyout respects the given RequestedTheme... although it doesn't seem to be picking up the theme changes from Windows user settings just yet...

This commit is contained in:
Daniel Clark
2021-02-07 11:22:26 +00:00
parent f4556c8314
commit 61305ca00f
5 changed files with 37 additions and 28 deletions
@@ -3,34 +3,12 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:NotificationFlyout.Uwp.UI.Controls"
CornerRadius="8">
CornerRadius="4"
RequestedTheme="Default">
<Grid
Width="330"
Height="360"
Margin="23">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Text="Quick lauch" />
<GridView Grid.Row="1" HorizontalAlignment="Center">
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsWrapGrid Orientation="Horizontal" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
<Button
Width="94"
Margin="6,6,3,6"
Content="Test" />
<Button
Width="94"
Margin="3,6,3,6"
Content="Test" />
<Button
Width="94"
Margin="3,6,6,6"
Content="Test" />
</GridView>
<ToggleSwitch x:Name="test" Toggled="ToggleSwitch_Toggled" />
</Grid>
</controls:NotificationFlyoutPresenter>
@@ -6,5 +6,18 @@
{
InitializeComponent();
}
private void ToggleSwitch_Toggled(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
if (test.IsOn)
{
this.RequestedTheme = Windows.UI.Xaml.ElementTheme.Dark;
}
else
{
this.RequestedTheme = Windows.UI.Xaml.ElementTheme.Light;
}
}
}
}