Figured out the lark with first display transition and transitions based on taskbar pos
This commit is contained in:
@@ -130,6 +130,9 @@
|
|||||||
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
|
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
|
||||||
<Version>6.2.11</Version>
|
<Version>6.2.11</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.UI.Xaml">
|
||||||
|
<Version>2.6.0-prerelease.210113001</Version>
|
||||||
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Page Include="MyUserControl1.xaml">
|
<Page Include="MyUserControl1.xaml">
|
||||||
|
|||||||
@@ -128,6 +128,9 @@
|
|||||||
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
|
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
|
||||||
<Version>6.2.11</Version>
|
<Version>6.2.11</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.UI.Xaml">
|
||||||
|
<Version>2.6.0-prerelease.210113001</Version>
|
||||||
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Page Include="NotificationFlyoutPresenter\NotificationFlyoutPresenter.xaml">
|
<Page Include="NotificationFlyoutPresenter\NotificationFlyoutPresenter.xaml">
|
||||||
|
|||||||
-7
@@ -26,13 +26,6 @@ namespace NotificationFlyout.Uwp.UI.Controls
|
|||||||
flyout.ShowAt(_root, new FlyoutShowOptions { Placement = placementMode, ShowMode = FlyoutShowMode.Standard });
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnApplyTemplate()
|
protected override void OnApplyTemplate()
|
||||||
{
|
{
|
||||||
_root = GetTemplateChild("Root") as Grid;
|
_root = GetTemplateChild("Root") as Grid;
|
||||||
|
|||||||
+40
-1
@@ -8,7 +8,46 @@
|
|||||||
<ControlTemplate TargetType="controls:NotificationFlyoutPresenter">
|
<ControlTemplate TargetType="controls:NotificationFlyoutPresenter">
|
||||||
<Grid x:Name="Root">
|
<Grid x:Name="Root">
|
||||||
<FlyoutBase.AttachedFlyout>
|
<FlyoutBase.AttachedFlyout>
|
||||||
<Flyout ShouldConstrainToRootBounds="False">
|
<Flyout AreOpenCloseAnimationsEnabled="False" ShouldConstrainToRootBounds="False">
|
||||||
|
<Flyout.FlyoutPresenterStyle>
|
||||||
|
<Style TargetType="FlyoutPresenter">
|
||||||
|
<Setter Property="BorderThickness" Value="0" />
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="FlyoutPresenter">
|
||||||
|
<Border
|
||||||
|
Background="{TemplateBinding Background}"
|
||||||
|
BackgroundSizing="InnerBorderEdge"
|
||||||
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
|
CornerRadius="{TemplateBinding CornerRadius}">
|
||||||
|
<Border.Transitions>
|
||||||
|
<TransitionCollection>
|
||||||
|
<EntranceThemeTransition FromHorizontalOffset="200" FromVerticalOffset="0" />
|
||||||
|
</TransitionCollection>
|
||||||
|
</Border.Transitions>
|
||||||
|
<ScrollViewer
|
||||||
|
x:Name="ScrollViewer"
|
||||||
|
AutomationProperties.AccessibilityView="Raw"
|
||||||
|
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
||||||
|
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
|
||||||
|
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
|
||||||
|
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
|
||||||
|
ZoomMode="{TemplateBinding ScrollViewer.ZoomMode}">
|
||||||
|
<ContentPresenter
|
||||||
|
Margin="{TemplateBinding Padding}"
|
||||||
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||||
|
Content="{TemplateBinding Content}"
|
||||||
|
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||||
|
ContentTransitions="{TemplateBinding ContentTransitions}" />
|
||||||
|
</ScrollViewer>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
</Flyout.FlyoutPresenterStyle>
|
||||||
<ContentControl Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" />
|
<ContentControl Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" />
|
||||||
</Flyout>
|
</Flyout>
|
||||||
</FlyoutBase.AttachedFlyout>
|
</FlyoutBase.AttachedFlyout>
|
||||||
|
|||||||
+16
-21
@@ -51,35 +51,29 @@ namespace NotificationFlyout.Wpf.UI.Controls
|
|||||||
|
|
||||||
internal void ShowFlyout()
|
internal void ShowFlyout()
|
||||||
{
|
{
|
||||||
var flyoutContentControl = GetNotificationFlyoutPresenter();
|
var notificationFlyoutPresenter = GetNotificationFlyoutPresenter();
|
||||||
if (flyoutContentControl != null)
|
if (notificationFlyoutPresenter != null)
|
||||||
{
|
{
|
||||||
var taskbarState = _taskbarHelper.GetCurrentState();
|
var taskbarState = _taskbarHelper.GetCurrentState();
|
||||||
|
var flyoutPlacement = taskbarState.Position switch
|
||||||
var flyoutPlacement = FlyoutPlacementMode.Auto;
|
|
||||||
switch (taskbarState.Position)
|
|
||||||
{
|
{
|
||||||
case TaskbarPosition.Left:
|
TaskbarPosition.Left => FlyoutPlacementMode.Right,
|
||||||
flyoutPlacement = FlyoutPlacementMode.Right;
|
TaskbarPosition.Top => FlyoutPlacementMode.Bottom,
|
||||||
break;
|
TaskbarPosition.Right => FlyoutPlacementMode.Left,
|
||||||
case TaskbarPosition.Top:
|
TaskbarPosition.Bottom => FlyoutPlacementMode.Top,
|
||||||
flyoutPlacement = FlyoutPlacementMode.Bottom;
|
_ => throw new ArgumentOutOfRangeException(),
|
||||||
break;
|
};
|
||||||
case TaskbarPosition.Right:
|
|
||||||
flyoutPlacement = FlyoutPlacementMode.Left;
|
|
||||||
break;
|
|
||||||
case TaskbarPosition.Bottom:
|
|
||||||
flyoutPlacement = FlyoutPlacementMode.Top;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
UpdateWindow();
|
|
||||||
Activate();
|
Activate();
|
||||||
|
notificationFlyoutPresenter.ShowFlyout(flyoutPlacement);
|
||||||
flyoutContentControl.ShowFlyout(flyoutPlacement);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SetFlyoutPlacement(FlyoutPlacementMode placementMode)
|
||||||
|
{
|
||||||
|
var notificationFlyoutPresenter = GetNotificationFlyoutPresenter();
|
||||||
|
}
|
||||||
|
|
||||||
private static void OnFlyoutContentPropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
|
private static void OnFlyoutContentPropertyChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
|
||||||
{
|
{
|
||||||
var sender = dependencyObject as NotificationFlyoutXamlHost;
|
var sender = dependencyObject as NotificationFlyoutXamlHost;
|
||||||
@@ -171,6 +165,7 @@ namespace NotificationFlyout.Wpf.UI.Controls
|
|||||||
var windowHeight = DesiredSize.Height * this.DpiY();
|
var windowHeight = DesiredSize.Height * this.DpiY();
|
||||||
|
|
||||||
var taskbarRect = taskbarState.Rect;
|
var taskbarRect = taskbarState.Rect;
|
||||||
|
var flyoutPlacement = FlyoutPlacementMode.Auto;
|
||||||
switch (taskbarState.Position)
|
switch (taskbarState.Position)
|
||||||
{
|
{
|
||||||
case TaskbarPosition.Left:
|
case TaskbarPosition.Left:
|
||||||
|
|||||||
@@ -3,4 +3,7 @@
|
|||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:xamlhost="using:Microsoft.Toolkit.Win32.UI.XamlHost">
|
xmlns:xamlhost="using:Microsoft.Toolkit.Win32.UI.XamlHost">
|
||||||
|
<xamlhost:XamlApplication.Resources>
|
||||||
|
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
|
||||||
|
</xamlhost:XamlApplication.Resources>
|
||||||
</xamlhost:XamlApplication>
|
</xamlhost:XamlApplication>
|
||||||
Reference in New Issue
Block a user