diff --git a/NotificationFlyout.Sample/NotificationFlyoutPresenter.xaml b/NotificationFlyout.Sample/NotificationFlyoutPresenter.xaml
index 88cdfea..599db7a 100644
--- a/NotificationFlyout.Sample/NotificationFlyoutPresenter.xaml
+++ b/NotificationFlyout.Sample/NotificationFlyoutPresenter.xaml
@@ -2,13 +2,15 @@
x:Class="NotificationFlyout.Sample.NotificationFlyoutPresenter"
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="4"
- RequestedTheme="Default">
+ xmlns:controls="using:NotificationFlyout.Uwp.UI.Controls">
-
+ Margin="24">
+
+ System
+ Dark
+ Light
+
diff --git a/NotificationFlyout.Sample/NotificationFlyoutPresenter.xaml.cs b/NotificationFlyout.Sample/NotificationFlyoutPresenter.xaml.cs
index e18280b..bd82345 100644
--- a/NotificationFlyout.Sample/NotificationFlyoutPresenter.xaml.cs
+++ b/NotificationFlyout.Sample/NotificationFlyoutPresenter.xaml.cs
@@ -7,13 +7,21 @@
InitializeComponent();
}
- private void ToggleSwitch_Toggled(object sender, Windows.UI.Xaml.RoutedEventArgs e)
+ private void test_SelectionChanged(object sender, Windows.UI.Xaml.Controls.SelectionChangedEventArgs e)
{
- if (test.IsOn)
+ if (test.SelectedIndex == 0)
+ {
+ this.RequestedTheme = Windows.UI.Xaml.ElementTheme.Default;
+
+ }
+
+ if (test.SelectedIndex == 1)
{
this.RequestedTheme = Windows.UI.Xaml.ElementTheme.Dark;
+
}
- else
+
+ if (test.SelectedIndex == 2)
{
this.RequestedTheme = Windows.UI.Xaml.ElementTheme.Light;
diff --git a/NotificationFlyout.Sample/Properties/AssemblyInfo.cs b/NotificationFlyout.Sample/Properties/AssemblyInfo.cs
index 52caaf9..31f2d77 100644
--- a/NotificationFlyout.Sample/Properties/AssemblyInfo.cs
+++ b/NotificationFlyout.Sample/Properties/AssemblyInfo.cs
@@ -14,7 +14,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-// Version information for an assembly consists of the following four values:
+//
+// information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
diff --git a/NotificationFlyout.Uwp.UI.Controls/NotificationFlyout.Uwp.UI.Controls.csproj b/NotificationFlyout.Uwp.UI.Controls/NotificationFlyout.Uwp.UI.Controls.csproj
index 715bafb..58d7770 100644
--- a/NotificationFlyout.Uwp.UI.Controls/NotificationFlyout.Uwp.UI.Controls.csproj
+++ b/NotificationFlyout.Uwp.UI.Controls/NotificationFlyout.Uwp.UI.Controls.csproj
@@ -121,6 +121,7 @@
+
@@ -138,6 +139,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
MSBuild:Compile
Designer
@@ -162,4 +167,7 @@
false
false
+
+ 9.0
+
\ No newline at end of file
diff --git a/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutContentPresenter.cs b/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutContentPresenter.cs
new file mode 100644
index 0000000..bb1398b
--- /dev/null
+++ b/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutContentPresenter.cs
@@ -0,0 +1,12 @@
+using Windows.UI.Xaml.Controls;
+
+namespace NotificationFlyout.Uwp.UI.Controls
+{
+ public class NotificationFlyoutContentPresenter : ContentControl
+ {
+ public NotificationFlyoutContentPresenter()
+ {
+ DefaultStyleKey = typeof(NotificationFlyoutContentPresenter);
+ }
+ }
+}
\ No newline at end of file
diff --git a/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutContentPresenter.xaml b/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutContentPresenter.xaml
new file mode 100644
index 0000000..88ff298
--- /dev/null
+++ b/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutContentPresenter.xaml
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutPresenter.cs b/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutPresenter.cs
index 4fc489c..44ee283 100644
--- a/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutPresenter.cs
+++ b/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutPresenter.cs
@@ -1,12 +1,47 @@
-using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
namespace NotificationFlyout.Uwp.UI.Controls
{
public class NotificationFlyoutPresenter : ContentControl
{
+ private NotificationFlyoutContentPresenter _contentPresenter;
+
public NotificationFlyoutPresenter()
{
DefaultStyleKey = typeof(NotificationFlyoutPresenter);
+ ActualThemeChanged += OnActualThemeChanged;
+ }
+
+ protected override void OnApplyTemplate()
+ {
+ _contentPresenter = GetTemplateChild("ContentPresenter") as NotificationFlyoutContentPresenter;
+ }
+
+ public void SetBackground(string theme)
+ {
+ if (_contentPresenter == null) return;
+ if (RequestedTheme == ElementTheme.Default)
+ {
+ ActualThemeChanged -= OnActualThemeChanged;
+
+ switch (theme)
+ {
+ case "Dark":
+ _contentPresenter.SetValue(RequestedThemeProperty, ElementTheme.Dark);
+ break;
+ case "Light":
+ _contentPresenter.SetValue(RequestedThemeProperty, ElementTheme.Light);
+ break;
+ }
+
+ ActualThemeChanged += OnActualThemeChanged;
+ }
+ }
+
+ private void OnActualThemeChanged(FrameworkElement sender, object args)
+ {
+ _contentPresenter.SetValue(RequestedThemeProperty, RequestedTheme);
}
}
}
\ No newline at end of file
diff --git a/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutPresenter.xaml b/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutPresenter.xaml
index 8a9dd7f..8266207 100644
--- a/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutPresenter.xaml
+++ b/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutPresenter.xaml
@@ -2,47 +2,14 @@
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">
-
-
-
-
-
-
-
-
-
-
-