diff --git a/NotificationFlyout.Package/NotificationFlyout.Package.wapproj b/NotificationFlyout.Package/NotificationFlyout.Package.wapproj
index a93c168..a78dee3 100644
--- a/NotificationFlyout.Package/NotificationFlyout.Package.wapproj
+++ b/NotificationFlyout.Package/NotificationFlyout.Package.wapproj
@@ -55,12 +55,12 @@
10.0.19041.0
en-US
false
- ..\NotificationFlyout.Tray\NotificationFlyout.Tray.csproj
False
True
True
neutral
0
+ ..\NotificationFlyout.Tray\NotificationFlyout.Sample.Wpf.csproj
Always
@@ -111,7 +111,7 @@
-
+
True
diff --git a/NotificationFlyout.Sample/MyUserControl1.xaml.cs b/NotificationFlyout.Sample/MyUserControl1.xaml.cs
deleted file mode 100644
index 3ee4049..0000000
--- a/NotificationFlyout.Sample/MyUserControl1.xaml.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Runtime.InteropServices.WindowsRuntime;
-using Windows.Foundation;
-using Windows.Foundation.Collections;
-using Windows.UI.Xaml;
-using Windows.UI.Xaml.Controls;
-using Windows.UI.Xaml.Controls.Primitives;
-using Windows.UI.Xaml.Data;
-using Windows.UI.Xaml.Input;
-using Windows.UI.Xaml.Media;
-using Windows.UI.Xaml.Navigation;
-
-// The User Control item template is documented at https://go.microsoft.com/fwlink/?LinkId=234236
-
-namespace NotificationFlyout.Sample
-{
- public sealed partial class MyUserControl1 : UserControl
- {
- public MyUserControl1()
- {
- this.InitializeComponent();
- }
- }
-}
diff --git a/NotificationFlyout.Sample/NotificationFlyout.Sample.csproj b/NotificationFlyout.Sample/NotificationFlyout.Sample.csproj
index 13db8e2..3119f2f 100644
--- a/NotificationFlyout.Sample/NotificationFlyout.Sample.csproj
+++ b/NotificationFlyout.Sample/NotificationFlyout.Sample.csproj
@@ -120,8 +120,8 @@
PackageReference
-
- MyUserControl1.xaml
+
+ NotificationFlyoutPresenter.xaml
@@ -135,11 +135,17 @@
-
+
Designer
MSBuild:Compile
+
+
+ {9987b132-e42c-401a-9ad5-e62529faca40}
+ NotificationFlyout.Uwp.UI.Controls
+
+
14.0
diff --git a/NotificationFlyout.Sample/MyUserControl1.xaml b/NotificationFlyout.Sample/NotificationFlyoutPresenter.xaml
similarity index 62%
rename from NotificationFlyout.Sample/MyUserControl1.xaml
rename to NotificationFlyout.Sample/NotificationFlyoutPresenter.xaml
index c5a3e26..812e2e0 100644
--- a/NotificationFlyout.Sample/MyUserControl1.xaml
+++ b/NotificationFlyout.Sample/NotificationFlyoutPresenter.xaml
@@ -1,7 +1,9 @@
-
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:controls="using:NotificationFlyout.Uwp.UI.Controls"
+ CornerRadius="4">
-
+
diff --git a/NotificationFlyout.Sample/NotificationFlyoutPresenter.xaml.cs b/NotificationFlyout.Sample/NotificationFlyoutPresenter.xaml.cs
new file mode 100644
index 0000000..1a461fd
--- /dev/null
+++ b/NotificationFlyout.Sample/NotificationFlyoutPresenter.xaml.cs
@@ -0,0 +1,10 @@
+namespace NotificationFlyout.Sample
+{
+ public sealed partial class NotificationFlyoutPresenter
+ {
+ public NotificationFlyoutPresenter()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/NotificationFlyout.Tray/App.xaml b/NotificationFlyout.Tray/App.xaml
index 46b9bb7..c4332d6 100644
--- a/NotificationFlyout.Tray/App.xaml
+++ b/NotificationFlyout.Tray/App.xaml
@@ -1,4 +1,4 @@
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/NotificationFlyout.Tray/App.xaml.cs b/NotificationFlyout.Tray/App.xaml.cs
index 2f338d1..9c36264 100644
--- a/NotificationFlyout.Tray/App.xaml.cs
+++ b/NotificationFlyout.Tray/App.xaml.cs
@@ -1,6 +1,6 @@
using System.Windows;
-namespace NotificationFlyout.Tray
+namespace NotificationFlyout.Sample.Wpf
{
public partial class App : Application
{
diff --git a/NotificationFlyout.Tray/NotificationFlyout.Tray.csproj b/NotificationFlyout.Tray/NotificationFlyout.Sample.Wpf.csproj
similarity index 88%
rename from NotificationFlyout.Tray/NotificationFlyout.Tray.csproj
rename to NotificationFlyout.Tray/NotificationFlyout.Sample.Wpf.csproj
index 4f1c3fb..16b2061 100644
--- a/NotificationFlyout.Tray/NotificationFlyout.Tray.csproj
+++ b/NotificationFlyout.Tray/NotificationFlyout.Sample.Wpf.csproj
@@ -6,8 +6,9 @@
true
uap10.0.19041
AnyCPU;x64
- NotificationFlyout.Tray.Program
+ NotificationFlyout.Sample.Wpf.Program
9.0
+ NotificationFlyout.Sample.Wpf
diff --git a/NotificationFlyout.Tray/Program.cs b/NotificationFlyout.Tray/Program.cs
index 3f2f8b7..4c8964c 100644
--- a/NotificationFlyout.Tray/Program.cs
+++ b/NotificationFlyout.Tray/Program.cs
@@ -1,7 +1,6 @@
-using NotificationFlyout.Tray.Views;
-using System;
+using System;
-namespace NotificationFlyout.Tray
+namespace NotificationFlyout.Sample.Wpf
{
public class Program
{
@@ -9,9 +8,9 @@ namespace NotificationFlyout.Tray
public static void Main()
{
using (new XamlHost.App())
- {
+ {
var app = new App();
- new Shell();
+ new SampleNotificationFlyout();
app.Run();
}
}
diff --git a/NotificationFlyout.Tray/Properties/AssemblyInfo.cs b/NotificationFlyout.Tray/Properties/AssemblyInfo.cs
index 4f943de..ecbfc49 100644
--- a/NotificationFlyout.Tray/Properties/AssemblyInfo.cs
+++ b/NotificationFlyout.Tray/Properties/AssemblyInfo.cs
@@ -1,10 +1,2 @@
using System.Windows;
-
-[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
-)]
\ No newline at end of file
+[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
\ No newline at end of file
diff --git a/NotificationFlyout.Tray/Views/Shell.xaml b/NotificationFlyout.Tray/SampleNotificationFlyout.xaml
similarity index 50%
rename from NotificationFlyout.Tray/Views/Shell.xaml
rename to NotificationFlyout.Tray/SampleNotificationFlyout.xaml
index 5bba08c..653c556 100644
--- a/NotificationFlyout.Tray/Views/Shell.xaml
+++ b/NotificationFlyout.Tray/SampleNotificationFlyout.xaml
@@ -1,10 +1,8 @@
-
-
-
-
+ xmlns:sample="clr-namespace:NotificationFlyout.Sample;assembly=NotificationFlyout.Sample"
+ IconSource="/Assets/Icon.ico">
+
diff --git a/NotificationFlyout.Tray/SampleNotificationFlyout.xaml.cs b/NotificationFlyout.Tray/SampleNotificationFlyout.xaml.cs
new file mode 100644
index 0000000..ada3e21
--- /dev/null
+++ b/NotificationFlyout.Tray/SampleNotificationFlyout.xaml.cs
@@ -0,0 +1,10 @@
+namespace NotificationFlyout.Sample.Wpf
+{
+ public partial class SampleNotificationFlyout
+ {
+ public SampleNotificationFlyout()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/NotificationFlyout.Tray/Views/Shell.xaml.cs b/NotificationFlyout.Tray/Views/Shell.xaml.cs
deleted file mode 100644
index 46cb886..0000000
--- a/NotificationFlyout.Tray/Views/Shell.xaml.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace NotificationFlyout.Tray.Views
-{
- public partial class Shell
- {
- public Shell()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/NotificationFlyout.Uwp.UI.Controls/NotificationFlyout.Uwp.UI.Controls.csproj b/NotificationFlyout.Uwp.UI.Controls/NotificationFlyout.Uwp.UI.Controls.csproj
index 4c9c495..906d225 100644
--- a/NotificationFlyout.Uwp.UI.Controls/NotificationFlyout.Uwp.UI.Controls.csproj
+++ b/NotificationFlyout.Uwp.UI.Controls/NotificationFlyout.Uwp.UI.Controls.csproj
@@ -120,8 +120,9 @@
PackageReference
+
-
+
@@ -134,10 +135,14 @@
-
+
Designer
MSBuild:Compile
+
+ MSBuild:Compile
+ Designer
+
MSBuild:Compile
Designer
diff --git a/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutHost/NotificationFlyoutHost.cs b/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutHost/NotificationFlyoutHost.cs
new file mode 100644
index 0000000..cad8da5
--- /dev/null
+++ b/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutHost/NotificationFlyoutHost.cs
@@ -0,0 +1,72 @@
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Controls.Primitives;
+
+namespace NotificationFlyout.Uwp.UI.Controls
+{
+ public class NotificationFlyoutHost : Control
+ {
+ public static readonly DependencyProperty FlyoutPresenterProperty =
+ DependencyProperty.Register(nameof(FlyoutPresenter),
+ typeof(NotificationFlyoutPresenter), typeof(NotificationFlyoutHost),
+ new PropertyMetadata(null));
+
+ public static readonly DependencyProperty TemplateSettingsProperty =
+ DependencyProperty.Register(nameof(TemplateSettings),
+ typeof(NotificationFlyoutHostTemplateSettings), typeof(NotificationFlyoutHost),
+ new PropertyMetadata(null));
+
+ private readonly NotificationFlyoutHostTemplateSettings _templateSettings;
+ private Grid _root;
+
+ public NotificationFlyoutHost()
+ {
+ DefaultStyleKey = typeof(NotificationFlyoutHost);
+
+ _templateSettings = new NotificationFlyoutHostTemplateSettings();
+ SetValue(TemplateSettingsProperty, _templateSettings);
+ }
+
+ public NotificationFlyoutPresenter FlyoutPresenter
+ {
+ get => (NotificationFlyoutPresenter)GetValue(FlyoutPresenterProperty);
+ set => SetValue(FlyoutPresenterProperty, value);
+ }
+
+ public NotificationFlyoutHostTemplateSettings TemplateSettings
+ {
+ get => (NotificationFlyoutHostTemplateSettings)GetValue(TemplateSettingsProperty);
+ set => SetValue(TemplateSettingsProperty, value);
+ }
+
+ public void HideFlyout()
+ {
+ if (_root == null) return;
+ FlyoutBase flyout = FlyoutBase.GetAttachedFlyout(_root);
+ flyout.Hide();
+ }
+
+ public void SetOffset(double verticalOffset, double horizontalOffset)
+ {
+ if (_templateSettings == null) return;
+ _templateSettings.FromVerticalOffset = verticalOffset;
+ _templateSettings.FromHorizontalOffset = horizontalOffset;
+ }
+
+ public void ShowFlyout(FlyoutPlacementMode placementMode)
+ {
+ if (_root == null) return;
+ var flyout = FlyoutBase.GetAttachedFlyout(_root);
+ flyout.ShowAt(_root, new FlyoutShowOptions
+ {
+ Placement = placementMode,
+ ShowMode = FlyoutShowMode.Standard
+ });
+ }
+
+ protected override void OnApplyTemplate()
+ {
+ _root = GetTemplateChild("Root") as Grid;
+ }
+ }
+}
\ No newline at end of file
diff --git a/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutHost/NotificationFlyoutHost.xaml b/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutHost/NotificationFlyoutHost.xaml
new file mode 100644
index 0000000..aab084f
--- /dev/null
+++ b/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutHost/NotificationFlyoutHost.xaml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutPresenterTemplateSettings.cs b/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutHost/NotificationFlyoutHostTemplateSettings.cs
similarity index 77%
rename from NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutPresenterTemplateSettings.cs
rename to NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutHost/NotificationFlyoutHostTemplateSettings.cs
index aab2d75..5aedfdf 100644
--- a/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutPresenterTemplateSettings.cs
+++ b/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutHost/NotificationFlyoutHostTemplateSettings.cs
@@ -2,16 +2,16 @@
namespace NotificationFlyout.Uwp.UI.Controls
{
- public class NotificationFlyoutPresenterTemplateSettings : DependencyObject
+ public class NotificationFlyoutHostTemplateSettings : DependencyObject
{
public static readonly DependencyProperty FromHorizontalOffsetProperty =
DependencyProperty.Register(nameof(FromHorizontalOffset),
- typeof(double), typeof(NotificationFlyoutPresenterTemplateSettings),
+ typeof(double), typeof(NotificationFlyoutHostTemplateSettings),
new PropertyMetadata(0d));
public static readonly DependencyProperty FromVerticalOffsetProperty =
DependencyProperty.Register(nameof(FromVerticalOffset),
- typeof(double), typeof(NotificationFlyoutPresenterTemplateSettings),
+ typeof(double), typeof(NotificationFlyoutHostTemplateSettings),
new PropertyMetadata(0d));
public double FromHorizontalOffset
diff --git a/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutPresenter.cs b/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutPresenter.cs
index 750002c..4fc489c 100644
--- a/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutPresenter.cs
+++ b/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutPresenter.cs
@@ -1,71 +1,12 @@
-using Windows.UI.Popups;
-using Windows.UI.ViewManagement;
-using Windows.UI.Xaml;
-using Windows.UI.Xaml.Controls;
-using Windows.UI.Xaml.Controls.Primitives;
+using Windows.UI.Xaml.Controls;
namespace NotificationFlyout.Uwp.UI.Controls
{
public class NotificationFlyoutPresenter : ContentControl
{
- public static readonly DependencyProperty TemplateSettingsProperty =
- DependencyProperty.Register(nameof(TemplateSettings),
- typeof(NotificationFlyoutPresenterTemplateSettings), typeof(NotificationFlyoutPresenter),
- new PropertyMetadata(null));
-
- private Grid _root;
- private NotificationFlyoutPresenterTemplateSettings _templateSettings;
-
public NotificationFlyoutPresenter()
{
DefaultStyleKey = typeof(NotificationFlyoutPresenter);
-
- _templateSettings = new NotificationFlyoutPresenterTemplateSettings();
- SetValue(TemplateSettingsProperty, _templateSettings);
-
- UISettings uiSettings = new UISettings();
- uiSettings.ColorValuesChanged += UiSettings_ColorValuesChanged;
- }
-
- private void UiSettings_ColorValuesChanged(UISettings sender, object args)
- {
- MessageDialog d = new MessageDialog("", "");
- }
-
- public NotificationFlyoutPresenterTemplateSettings TemplateSettings
- {
- get => (NotificationFlyoutPresenterTemplateSettings)GetValue(TemplateSettingsProperty);
- set => SetValue(TemplateSettingsProperty, value);
- }
-
- public void SetOffset(double verticalOffset, double horizontalOffset)
- {
- if (_templateSettings == null) return;
- _templateSettings.FromVerticalOffset = verticalOffset;
- _templateSettings.FromHorizontalOffset = horizontalOffset;
- }
-
- public void HideFlyout()
- {
- if (_root == null) return;
- FlyoutBase flyout = FlyoutBase.GetAttachedFlyout(_root);
- flyout.Hide();
- }
-
- public void ShowFlyout(FlyoutPlacementMode placementMode)
- {
- if (_root == null) return;
- var flyout = FlyoutBase.GetAttachedFlyout(_root);
- flyout.ShowAt(_root, new FlyoutShowOptions
- {
- Placement = placementMode,
- ShowMode = FlyoutShowMode.Standard
- });
- }
-
- protected override void OnApplyTemplate()
- {
- _root = GetTemplateChild("Root") as Grid;
}
}
}
\ 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 64cc30c..5a4e269 100644
--- a/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutPresenter.xaml
+++ b/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutPresenter.xaml
@@ -7,50 +7,35 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/NotificationFlyout.Uwp.UI.Controls/Properties/AssemblyInfo.cs b/NotificationFlyout.Uwp.UI.Controls/Properties/AssemblyInfo.cs
index f214d3a..836252c 100644
--- a/NotificationFlyout.Uwp.UI.Controls/Properties/AssemblyInfo.cs
+++ b/NotificationFlyout.Uwp.UI.Controls/Properties/AssemblyInfo.cs
@@ -1,9 +1,6 @@
using System.Reflection;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
[assembly: AssemblyTitle("NotificationFlyout.Uwp.UI.Controls")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
@@ -12,17 +9,6 @@ using System.Runtime.InteropServices;
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
-[assembly: ComVisible(false)]
\ No newline at end of file
+[assembly: ComVisible(false)]
diff --git a/NotificationFlyout.Uwp.UI.Controls/Themes/Generic.xaml b/NotificationFlyout.Uwp.UI.Controls/Themes/Generic.xaml
index bbc6012..ccdd7da 100644
--- a/NotificationFlyout.Uwp.UI.Controls/Themes/Generic.xaml
+++ b/NotificationFlyout.Uwp.UI.Controls/Themes/Generic.xaml
@@ -1,6 +1,6 @@
-
+
+
\ No newline at end of file
diff --git a/NotificationFlyout.Wpf.UI.Controls/NotificationFlyout/NotificationFlyout.cs b/NotificationFlyout.Wpf.UI.Controls/NotificationFlyout/NotificationFlyout.cs
index 38b6be0..9e73b85 100644
--- a/NotificationFlyout.Wpf.UI.Controls/NotificationFlyout/NotificationFlyout.cs
+++ b/NotificationFlyout.Wpf.UI.Controls/NotificationFlyout/NotificationFlyout.cs
@@ -1,26 +1,33 @@
-using NotificationFlyout.Wpf.UI.Extensions;
+using NotificationFlyout.Uwp.UI.Controls;
+using NotificationFlyout.Wpf.UI.Extensions;
using NotificationFlyout.Wpf.UI.Helpers;
using System.Windows;
using System.Windows.Markup;
+using System.Windows.Media;
namespace NotificationFlyout.Wpf.UI.Controls
{
- [ContentProperty(nameof(Content))]
+ [ContentProperty(nameof(FlyoutPresenter))]
public class NotificationFlyout : DependencyObject
{
+ public static readonly DependencyProperty IconSourceProperty =
+ DependencyProperty.Register(nameof(IconSource),
+ typeof(ImageSource), typeof(NotificationFlyout),
+ new PropertyMetadata(null, OnIconPropertyChanged));
+
+ public static readonly DependencyProperty LightIconSourceProperty =
+ DependencyProperty.Register(nameof(LightIconSource),
+ typeof(ImageSource), typeof(NotificationFlyout),
+ new PropertyMetadata(null, OnIconPropertyChanged));
+
+ public static DependencyProperty FlyoutPresenterProperty =
+ DependencyProperty.Register(nameof(FlyoutPresenter),
+ typeof(NotificationFlyoutPresenter), typeof(NotificationFlyout),
+ new PropertyMetadata(null, OnFlyoutPresenterPropertyChanged));
+
private const string ShellTrayHandleName = "Shell_TrayWnd";
- public static readonly DependencyProperty IconProperty =
- DependencyProperty.Register(nameof(Icon),
- typeof(NotificationFlyoutIcon), typeof(NotificationFlyout),
- new PropertyMetadata(null, OnIconPropertyChanged));
-
- public static DependencyProperty ContentProperty =
- DependencyProperty.Register(nameof(Content),
- typeof(Windows.UI.Xaml.UIElement), typeof(NotificationFlyout),
- new PropertyMetadata(null, OnContentPropertyChanged));
-
- private NotificationFlyoutXamlHost _xamlHost;
+ private readonly NotificationFlyoutXamlHost _xamlHost;
public NotificationFlyout()
{
@@ -28,16 +35,22 @@ namespace NotificationFlyout.Wpf.UI.Controls
_xamlHost.Show();
}
- public Windows.UI.Xaml.UIElement Content
+ public NotificationFlyoutPresenter FlyoutPresenter
{
- get => (Windows.UI.Xaml.UIElement)GetValue(ContentProperty);
- set => SetValue(ContentProperty, value);
+ get => (NotificationFlyoutPresenter)GetValue(FlyoutPresenterProperty);
+ set => SetValue(FlyoutPresenterProperty, value);
}
- public NotificationFlyoutIcon Icon
+ public ImageSource IconSource
{
- get => (NotificationFlyoutIcon)GetValue(IconProperty);
- set => SetValue(IconProperty, value);
+ get => (ImageSource)GetValue(IconSourceProperty);
+ set => SetValue(IconSourceProperty, value);
+ }
+
+ public ImageSource LightIconSource
+ {
+ get => (ImageSource)GetValue(LightIconSourceProperty);
+ set => SetValue(LightIconSourceProperty, value);
}
public void HideFlyout()
@@ -50,10 +63,10 @@ namespace NotificationFlyout.Wpf.UI.Controls
_xamlHost.ShowFlyout();
}
- private static void OnContentPropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
+ private static void OnFlyoutPresenterPropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
{
var sender = dependencyObject as NotificationFlyout;
- sender?.OnContentPropertyChanged();
+ sender?.OnFlyoutPresenterPropertyChanged();
}
private static void OnIconPropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs args)
@@ -62,9 +75,9 @@ namespace NotificationFlyout.Wpf.UI.Controls
sender?.OnIconPropertyChanged();
}
- private void OnContentPropertyChanged()
+ private void OnFlyoutPresenterPropertyChanged()
{
- _xamlHost.SetFlyoutContent(Content);
+ _xamlHost.SetFlyoutPresenter(FlyoutPresenter);
}
private void OnIconPropertyChanged()
@@ -74,7 +87,7 @@ namespace NotificationFlyout.Wpf.UI.Controls
var dpi = WindowHelper.GetDpi(shellTrayHandle);
- var iconSource = SystemSettingsHelper.DefaultSystemTheme == SystemTheme.Dark ? Icon.IconSource : Icon.LightIconSource;
+ var iconSource = SystemSettingsHelper.DefaultSystemTheme == SystemTheme.Dark ? IconSource : LightIconSource;
using var icon = iconSource.ConvertToIcon(dpi);
_xamlHost.SetNotificationIcon(icon.Handle);
diff --git a/NotificationFlyout.Wpf.UI.Controls/NotificationFlyout/NotificationFlyoutIcon.cs b/NotificationFlyout.Wpf.UI.Controls/NotificationFlyout/NotificationFlyoutIcon.cs
deleted file mode 100644
index 323b78a..0000000
--- a/NotificationFlyout.Wpf.UI.Controls/NotificationFlyout/NotificationFlyoutIcon.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using System.Windows;
-using System.Windows.Media;
-
-namespace NotificationFlyout.Wpf.UI.Controls
-{
- public class NotificationFlyoutIcon : DependencyObject
- {
- public static readonly DependencyProperty IconSourceProperty =
- DependencyProperty.Register(nameof(IconSource),
- typeof(ImageSource), typeof(NotificationFlyout));
-
- public static readonly DependencyProperty LightIconSourceProperty =
- DependencyProperty.Register(nameof(LightIconSource),
- typeof(ImageSource), typeof(NotificationFlyout));
-
- public ImageSource IconSource
- {
- get => (ImageSource)GetValue(IconSourceProperty);
- set => SetValue(IconSourceProperty, value);
- }
-
- public ImageSource LightIconSource
- {
- get => (ImageSource)GetValue(LightIconSourceProperty);
- set => SetValue(LightIconSourceProperty, value);
- }
- }
-}
\ No newline at end of file
diff --git a/NotificationFlyout.Wpf.UI.Controls/NotificationFlyout/NotificationFlyoutXamlHost.cs b/NotificationFlyout.Wpf.UI.Controls/NotificationFlyout/NotificationFlyoutXamlHost.cs
index 34e30de..07cdb96 100644
--- a/NotificationFlyout.Wpf.UI.Controls/NotificationFlyout/NotificationFlyoutXamlHost.cs
+++ b/NotificationFlyout.Wpf.UI.Controls/NotificationFlyout/NotificationFlyoutXamlHost.cs
@@ -12,10 +12,9 @@ namespace NotificationFlyout.Wpf.UI.Controls
internal class NotificationFlyoutXamlHost : Window
{
private const double MaximumOffset = 80;
- private WindowsXamlHost _host;
-
private NotificationIconHelper _notificationIconHelper;
private TaskbarHelper _taskbarHelper;
+ private WindowsXamlHost _xamlHost;
public NotificationFlyoutXamlHost()
{
@@ -25,21 +24,21 @@ namespace NotificationFlyout.Wpf.UI.Controls
Loaded += OnLoaded;
}
- public void SetFlyoutContent(Windows.UI.Xaml.UIElement content)
+ public void SetFlyoutPresenter(NotificationFlyoutPresenter flyoutPresenter)
{
- var flyoutPresenter = GetNotificationFlyoutPresenter();
- if (flyoutPresenter != null)
+ var flyoutHost = GetFlyoutHost();
+ if (flyoutHost != null)
{
- flyoutPresenter.Content = content;
+ flyoutHost.FlyoutPresenter = flyoutPresenter;
}
}
internal void HideFlyout()
{
- var flyoutContentControl = GetNotificationFlyoutPresenter();
- if (flyoutContentControl != null)
+ var flyoutHost = GetFlyoutHost();
+ if (flyoutHost != null)
{
- flyoutContentControl.HideFlyout();
+ flyoutHost.HideFlyout();
}
}
@@ -47,10 +46,11 @@ namespace NotificationFlyout.Wpf.UI.Controls
{
_notificationIconHelper.SetIcon(handle);
}
+
internal void ShowFlyout()
{
- var flyoutPresenter = GetNotificationFlyoutPresenter();
- if (flyoutPresenter != null)
+ var flyoutHost = GetFlyoutHost();
+ if (flyoutHost != null)
{
var taskbarState = _taskbarHelper.GetCurrentState();
var flyoutPlacement = taskbarState.Position switch
@@ -63,15 +63,16 @@ namespace NotificationFlyout.Wpf.UI.Controls
};
Activate();
- flyoutPresenter.ShowFlyout(flyoutPlacement);
+ flyoutHost.ShowFlyout(flyoutPlacement);
}
}
- private NotificationFlyoutPresenter GetNotificationFlyoutPresenter()
+ private NotificationFlyoutHost GetFlyoutHost()
{
- if (_host == null) return null;
- return _host.GetUwpInternalObject() as NotificationFlyoutPresenter;
+ if (_xamlHost == null) return null;
+ return _xamlHost.GetUwpInternalObject() as NotificationFlyoutHost;
}
+
private void OnIconInvoked(object sender, NotificationIconInvokedEventArgs args)
{
ShowFlyout();
@@ -120,21 +121,21 @@ namespace NotificationFlyout.Wpf.UI.Controls
private void PrepareWindowsXamlHost()
{
- _host = new WindowsXamlHost
+ _xamlHost = new WindowsXamlHost
{
- InitialTypeName = typeof(NotificationFlyoutPresenter).FullName
+ InitialTypeName = typeof(NotificationFlyoutHost).FullName
};
- _host.Height = 0;
- _host.Width = 0;
+ _xamlHost.Height = 0;
+ _xamlHost.Width = 0;
- Content = _host;
+ Content = _xamlHost;
}
private void UpdateWindow()
{
- var flyoutPresenter = GetNotificationFlyoutPresenter();
- if (flyoutPresenter == null) return;
+ var flyoutHost = GetFlyoutHost();
+ if (flyoutHost == null) return;
var taskbarState = _taskbarHelper.GetCurrentState();
@@ -187,7 +188,7 @@ namespace NotificationFlyout.Wpf.UI.Controls
}
this.SetWindowPosition(top, left, height, width);
- flyoutPresenter.SetOffset(verticalOffset, horizontalOffset);
+ flyoutHost.SetOffset(verticalOffset, horizontalOffset);
}
}
}
\ No newline at end of file
diff --git a/NotificationFlyout.Wpf.UI/Properties/AssemblyInfo.cs b/NotificationFlyout.Wpf.UI/Properties/AssemblyInfo.cs
index 4f943de..c0ea722 100644
--- a/NotificationFlyout.Wpf.UI/Properties/AssemblyInfo.cs
+++ b/NotificationFlyout.Wpf.UI/Properties/AssemblyInfo.cs
@@ -1,10 +1,3 @@
using System.Windows;
-[assembly: ThemeInfo(
- ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
- //(used if a resource is not found in the page,
- // or application resource dictionaries)
- ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
- //(used if a resource is not found in the page,
- // app, or any theme specific resource dictionaries)
-)]
\ No newline at end of file
+[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
\ No newline at end of file
diff --git a/NotificationFlyout.sln b/NotificationFlyout.sln
index 0d5c68e..b41cd5c 100644
--- a/NotificationFlyout.sln
+++ b/NotificationFlyout.sln
@@ -7,7 +7,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotificationFlyout.Foundati
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotificationFlyout.XamlHost", "NotificationFlyout.XamlHost\NotificationFlyout.XamlHost.csproj", "{95D6E127-BC04-4591-ACFF-FB35BBB64884}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotificationFlyout.Tray", "NotificationFlyout.Tray\NotificationFlyout.Tray.csproj", "{B5B09576-6447-4146-B544-FB6000587D8B}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotificationFlyout.Sample.Wpf", "NotificationFlyout.Tray\NotificationFlyout.Sample.Wpf.csproj", "{B5B09576-6447-4146-B544-FB6000587D8B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotificationFlyout.Wpf.UI.Controls", "NotificationFlyout.Wpf.UI.Controls\NotificationFlyout.Wpf.UI.Controls.csproj", "{0A782234-DC9F-4C4A-8820-FC640B03D233}"
EndProject