diff --git a/samples/NotificationFlyoutSample/SampleFlyout.xaml b/samples/NotificationFlyoutSample/SampleFlyout.xaml
index ad54932..a85c1a3 100644
--- a/samples/NotificationFlyoutSample/SampleFlyout.xaml
+++ b/samples/NotificationFlyoutSample/SampleFlyout.xaml
@@ -2,31 +2,32 @@
x:Class="NotificationFlyoutSample.SampleFlyout"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:controls="using:TheXamlGuy.NotificationFlyout.Uwp.UI.Controls">
+ xmlns:controls="using:TheXamlGuy.NotificationFlyout.Uwp.UI.Controls"
+ VerticalContentAlignment="Top">
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/TheXamlGuy.NotificationFlyout.Uwp.UI.Controls/NotificationFlyout/NotificationFlyout.cs b/src/TheXamlGuy.NotificationFlyout.Uwp.UI.Controls/NotificationFlyout/NotificationFlyout.cs
index 260ef7b..a940410 100644
--- a/src/TheXamlGuy.NotificationFlyout.Uwp.UI.Controls/NotificationFlyout/NotificationFlyout.cs
+++ b/src/TheXamlGuy.NotificationFlyout.Uwp.UI.Controls/NotificationFlyout/NotificationFlyout.cs
@@ -38,7 +38,7 @@ namespace TheXamlGuy.NotificationFlyout.Uwp.UI.Controls
typeof(NotificationFlyoutTemplateSettings), typeof(NotificationFlyout),
new PropertyMetadata(null));
- private const double OffsetValue = 1;
+ private const double OffsetValue = 6;
private static INotificationFlyoutApplication _applicationInstance;
@@ -143,8 +143,8 @@ namespace TheXamlGuy.NotificationFlyout.Uwp.UI.Controls
_child.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
- var width = _child.DesiredSize.Width;
- var height = Placement == NotificationFlyoutPlacement.Auto ? _child.DesiredSize.Height : workingAreaHeight;
+ var width = _child.DesiredSize.Width - 1;
+ var height = Placement == NotificationFlyoutPlacement.Auto ? _child.DesiredSize.Height : workingAreaHeight + 1;
var desiredHorizontalOffset = horizontalOffset;
var desiredVerticalOffset = verticalOffset;
@@ -161,15 +161,15 @@ namespace TheXamlGuy.NotificationFlyout.Uwp.UI.Controls
desiredVerticalOffset -= height;
break;
case NotificationFlyoutTaskbarPlacement.Top:
- desiredHorizontalOffset -= width;
+ desiredHorizontalOffset -= width + OffsetValue;
desiredVerticalOffset -= OffsetValue;
break;
case NotificationFlyoutTaskbarPlacement.Right:
- desiredHorizontalOffset -= width;
+ desiredHorizontalOffset -= width + OffsetValue;
desiredVerticalOffset -= height;
break;
case NotificationFlyoutTaskbarPlacement.Bottom:
- desiredHorizontalOffset -= width;
+ desiredHorizontalOffset -= width + OffsetValue;
desiredVerticalOffset -= height;
break;
}
@@ -180,19 +180,20 @@ namespace TheXamlGuy.NotificationFlyout.Uwp.UI.Controls
switch (flyoutTaskbarPlacement)
{
case NotificationFlyoutTaskbarPlacement.Left:
- desiredHorizontalOffset += workingAreaWidth - width;
- desiredVerticalOffset = 0;
+ desiredHorizontalOffset += workingAreaWidth - width - OffsetValue;
+ desiredVerticalOffset = -OffsetValue;
break;
case NotificationFlyoutTaskbarPlacement.Top:
- desiredHorizontalOffset = workingAreaWidth - width;
+ desiredHorizontalOffset = workingAreaWidth - width - OffsetValue;
+ desiredVerticalOffset += -OffsetValue;
break;
case NotificationFlyoutTaskbarPlacement.Right:
- desiredHorizontalOffset -= width;
- desiredVerticalOffset = 0;
+ desiredHorizontalOffset -= width + OffsetValue;
+ desiredVerticalOffset = -OffsetValue;
break;
case NotificationFlyoutTaskbarPlacement.Bottom:
- desiredHorizontalOffset = workingAreaWidth - width;
- desiredVerticalOffset = 0;
+ desiredHorizontalOffset -= width + OffsetValue;
+ desiredVerticalOffset = -OffsetValue;
break;
}
break;
diff --git a/src/TheXamlGuy.NotificationFlyout.Wpf.UI.Controls/NotificationFlyout/NotificationFlyoutApplication.cs b/src/TheXamlGuy.NotificationFlyout.Wpf.UI.Controls/NotificationFlyout/NotificationFlyoutApplication.cs
index a5e34b4..89803cc 100644
--- a/src/TheXamlGuy.NotificationFlyout.Wpf.UI.Controls/NotificationFlyout/NotificationFlyoutApplication.cs
+++ b/src/TheXamlGuy.NotificationFlyout.Wpf.UI.Controls/NotificationFlyout/NotificationFlyoutApplication.cs
@@ -71,7 +71,6 @@ namespace TheXamlGuy.NotificationFlyout.Wpf.UI.Controls
window.Show();
}
-
public void OpenFlyout()
{
if (Flyout == null) return;
@@ -119,12 +118,15 @@ namespace TheXamlGuy.NotificationFlyout.Wpf.UI.Controls
_isDpiChanging = true;
- UpdateIcons();
_notificationFlyoutXamlHost.Visibility = Visibility.Visible;
await Dispatcher.BeginInvoke(new Action(() =>
{
VisualTreeHelper.SetRootDpi(_notificationFlyoutXamlHost, args.OldDpi);
+ }), DispatcherPriority.ContextIdle, null);
+
+ await Dispatcher.BeginInvoke(new Action(() =>
+ {
VisualTreeHelper.SetRootDpi(_notificationFlyoutXamlHost, args.NewDpi);
}), DispatcherPriority.ContextIdle, null);
@@ -133,6 +135,8 @@ namespace TheXamlGuy.NotificationFlyout.Wpf.UI.Controls
_notificationFlyoutXamlHost.Visibility = Visibility.Hidden;
_isDpiChanging = false;
}), DispatcherPriority.ContextIdle, null);
+
+ UpdateIcons();
}
private void OnTaskbarChanged(object sender, EventArgs args) => UpdateFlyoutPlacement();
@@ -187,8 +191,9 @@ namespace TheXamlGuy.NotificationFlyout.Wpf.UI.Controls
{
if (Flyout == null) return;
- _notificationFlyoutXamlHost.Left = 0;
- _notificationFlyoutXamlHost.Top = 0;
+ var taskbarState = _taskbarHelper.GetCurrentState();
+ _notificationFlyoutXamlHost.Left = taskbarState.Screen.Bounds.Left;
+ _notificationFlyoutXamlHost.Top = taskbarState.Screen.Bounds.Top;
double horizontalOffset;
double verticalOffset;
@@ -196,12 +201,10 @@ namespace TheXamlGuy.NotificationFlyout.Wpf.UI.Controls
var dpiX = _notificationFlyoutXamlHost.DpiX();
var dpiY = _notificationFlyoutXamlHost.DpiY();
- NotificationFlyoutTaskbarPlacement flyoutTaskBarPlacement;
-
- var taskbarState = _taskbarHelper.GetCurrentState();
var workingAreaHeight = taskbarState.Screen.WorkingArea.Height / dpiX;
var workingAreaWidth = taskbarState.Screen.WorkingArea.Width / dpiY;
+ NotificationFlyoutTaskbarPlacement flyoutTaskBarPlacement;
switch (taskbarState.Placement)
{
case TaskbarPlacement.Left:
diff --git a/src/TheXamlGuy.NotificationFlyout.Wpf.UI.Controls/XamlHost/TransparentXamlHost.cs b/src/TheXamlGuy.NotificationFlyout.Wpf.UI.Controls/XamlHost/TransparentXamlHost.cs
index 3cb2021..86de72a 100644
--- a/src/TheXamlGuy.NotificationFlyout.Wpf.UI.Controls/XamlHost/TransparentXamlHost.cs
+++ b/src/TheXamlGuy.NotificationFlyout.Wpf.UI.Controls/XamlHost/TransparentXamlHost.cs
@@ -8,7 +8,7 @@ namespace TheXamlGuy.NotificationFlyout.Wpf.UI.Controls
{
internal class TransparentXamlHost : XamlHost where TXamlContent : Windows.UI.Xaml.UIElement
{
- internal const double WindowSize = 1;
+ internal const double WindowSize = 10;
public TransparentXamlHost() => PrepareDefaultWindow();
@@ -31,7 +31,7 @@ namespace TheXamlGuy.NotificationFlyout.Wpf.UI.Controls
WindowStyle = WindowStyle.None;
ResizeMode = ResizeMode.NoResize;
AllowsTransparency = true;
- Background = new SolidColorBrush(Colors.Transparent);
+ Background = new SolidColorBrush(Colors.Red);
Height = WindowSize;
Width = WindowSize;
}