Figured out the lark with first display transition and transitions based on taskbar pos

This commit is contained in:
Daniel Clark
2021-02-05 12:35:22 +00:00
parent 275bded665
commit 7e05f5ed75
6 changed files with 66 additions and 30 deletions
@@ -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: