Skip to content

Commit 5cc3ed2

Browse files
committed
Feat | Try Icon Animation
1 parent 25fc872 commit 5cc3ed2

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

ShadowViewer/Pages/NavigationPage.xaml.cs

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
using System;
2+
using System.Numerics;
23
using System.Threading;
4+
using Windows.Foundation;
5+
using CommunityToolkit.WinUI;
6+
using CommunityToolkit.WinUI.Animations;
37
using DryIoc;
8+
using Microsoft.UI.Composition;
49
using Microsoft.UI.Xaml;
510
using Microsoft.UI.Xaml.Controls;
611
using Microsoft.UI.Xaml.Input;
@@ -15,6 +20,7 @@
1520
using ShadowViewer.ViewModels;
1621
using ShadowViewer.Services;
1722
using ShadowViewer.Core.Controls;
23+
using Microsoft.UI.Xaml.Media;
1824

1925
namespace ShadowViewer.Pages
2026
{
@@ -74,7 +80,7 @@ private async void Caller_TopGridEvent(object sender, TopGridEventArg e)
7480
{
7581
case TopGridMode.ContentDialog:
7682
if (e.Element is ContentDialog dialog)
77-
{
83+
{
7884
await dialog.ShowAsync();
7985
}
8086

@@ -117,6 +123,11 @@ args.InvokedItemContainer.Tag is IShadowNavigationItem item &&
117123
parameter = navigation.Parameter;
118124
page = navigation.Page;
119125
info = navigation.Info;
126+
if (item.Icon != null)
127+
{
128+
var xy = new Vector2(item.Icon.ActualSize.X * 0.5f, item.Icon.ActualSize.Y * 0.5f);
129+
item.StartAnimation?.CenterPoint(xy, xy).Start(item.Icon);
130+
}
120131
}
121132

122133
info ??= args.RecommendedNavigationTransitionInfo;
@@ -134,7 +145,6 @@ private void NavView_Loaded(object sender, RoutedEventArgs e)
134145
{
135146
}
136147

137-
138148

139149
private void SmokeGrid_RightTapped(object sender, RightTappedRoutedEventArgs e)
140150
{

0 commit comments

Comments
 (0)