diff --git a/NotificationFlyout.Sample/NotificationFlyout.Sample.csproj b/NotificationFlyout.Sample/NotificationFlyout.Sample.csproj index 1c63192..13db8e2 100644 --- a/NotificationFlyout.Sample/NotificationFlyout.Sample.csproj +++ b/NotificationFlyout.Sample/NotificationFlyout.Sample.csproj @@ -130,6 +130,9 @@ 6.2.11 + + 2.6.0-prerelease.210113001 + diff --git a/NotificationFlyout.Uwp.UI.Controls/NotificationFlyout.Uwp.UI.Controls.csproj b/NotificationFlyout.Uwp.UI.Controls/NotificationFlyout.Uwp.UI.Controls.csproj index a37733c..58844c4 100644 --- a/NotificationFlyout.Uwp.UI.Controls/NotificationFlyout.Uwp.UI.Controls.csproj +++ b/NotificationFlyout.Uwp.UI.Controls/NotificationFlyout.Uwp.UI.Controls.csproj @@ -128,6 +128,9 @@ 6.2.11 + + 2.6.0-prerelease.210113001 + diff --git a/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutPresenter.cs b/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutPresenter.cs index 06f1875..43def01 100644 --- a/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutPresenter.cs +++ b/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutPresenter.cs @@ -20,17 +20,10 @@ namespace NotificationFlyout.Uwp.UI.Controls } public void ShowFlyout(FlyoutPlacementMode placementMode) - { - if (_root == null) return; - var flyout = FlyoutBase.GetAttachedFlyout(_root); - flyout.ShowAt(_root, new FlyoutShowOptions { Placement = placementMode, ShowMode = FlyoutShowMode.Standard }); - } - - public void ShowFlyout() { if (_root == null) return; var flyout = FlyoutBase.GetAttachedFlyout(_root); - flyout.ShowAt(_root); + flyout.ShowAt(_root, new FlyoutShowOptions { Placement = placementMode, ShowMode = FlyoutShowMode.Standard }); } protected override void OnApplyTemplate() diff --git a/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutPresenter.xaml b/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutPresenter.xaml index 4e84d32..555b9b5 100644 --- a/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutPresenter.xaml +++ b/NotificationFlyout.Uwp.UI.Controls/NotificationFlyoutPresenter/NotificationFlyoutPresenter.xaml @@ -8,7 +8,46 @@ - + + + + diff --git a/NotificationFlyout.Wpf.UI.Controls/NotificationFlyout/NotificationFlyoutXamlHost.cs b/NotificationFlyout.Wpf.UI.Controls/NotificationFlyout/NotificationFlyoutXamlHost.cs index 95024af..9bfd510 100644 --- a/NotificationFlyout.Wpf.UI.Controls/NotificationFlyout/NotificationFlyoutXamlHost.cs +++ b/NotificationFlyout.Wpf.UI.Controls/NotificationFlyout/NotificationFlyoutXamlHost.cs @@ -51,35 +51,29 @@ namespace NotificationFlyout.Wpf.UI.Controls internal void ShowFlyout() { - var flyoutContentControl = GetNotificationFlyoutPresenter(); - if (flyoutContentControl != null) + var notificationFlyoutPresenter = GetNotificationFlyoutPresenter(); + if (notificationFlyoutPresenter != null) { var taskbarState = _taskbarHelper.GetCurrentState(); - - var flyoutPlacement = FlyoutPlacementMode.Auto; - switch (taskbarState.Position) + var flyoutPlacement = taskbarState.Position switch { - case TaskbarPosition.Left: - flyoutPlacement = FlyoutPlacementMode.Right; - break; - case TaskbarPosition.Top: - flyoutPlacement = FlyoutPlacementMode.Bottom; - break; - case TaskbarPosition.Right: - flyoutPlacement = FlyoutPlacementMode.Left; - break; - case TaskbarPosition.Bottom: - flyoutPlacement = FlyoutPlacementMode.Top; - break; - } + TaskbarPosition.Left => FlyoutPlacementMode.Right, + TaskbarPosition.Top => FlyoutPlacementMode.Bottom, + TaskbarPosition.Right => FlyoutPlacementMode.Left, + TaskbarPosition.Bottom => FlyoutPlacementMode.Top, + _ => throw new ArgumentOutOfRangeException(), + }; - UpdateWindow(); Activate(); - - flyoutContentControl.ShowFlyout(flyoutPlacement); + notificationFlyoutPresenter.ShowFlyout(flyoutPlacement); } } + private void SetFlyoutPlacement(FlyoutPlacementMode placementMode) + { + var notificationFlyoutPresenter = GetNotificationFlyoutPresenter(); + } + private static void OnFlyoutContentPropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs) { var sender = dependencyObject as NotificationFlyoutXamlHost; @@ -171,6 +165,7 @@ namespace NotificationFlyout.Wpf.UI.Controls var windowHeight = DesiredSize.Height * this.DpiY(); var taskbarRect = taskbarState.Rect; + var flyoutPlacement = FlyoutPlacementMode.Auto; switch (taskbarState.Position) { case TaskbarPosition.Left: diff --git a/NotificationFlyout.XamlHost/App.xaml b/NotificationFlyout.XamlHost/App.xaml index 5371cf7..41474d6 100644 --- a/NotificationFlyout.XamlHost/App.xaml +++ b/NotificationFlyout.XamlHost/App.xaml @@ -3,4 +3,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:xamlhost="using:Microsoft.Toolkit.Win32.UI.XamlHost"> + + + \ No newline at end of file