-
I notice that |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I made the Forward connected animation working with this private void Section2ItemRepeater_ItemInvoked(Microsoft.UI.Xaml.Controls.ItemsView sender, Microsoft.UI.Xaml.Controls.ItemsViewItemInvokedEventArgs args)
{
var selectedCard = args.InvokedItem as ProfileCardModel;
if (selectedCard is null)
return;
var elementToAnimate = FindElementByTag(this, selectedCard.Id) as UIElement;
if (elementToAnimate is null)
return;
ViewedItem = selectedCard;
ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("ForwardConnectedAnimation", elementToAnimate);
Detail.Parameter pageParameter = new(selectedCard.Id, selectedCard.ImagePath);
Frame.Navigate(typeof(Detail.Page),
pageParameter,
new SlideNavigationTransitionInfo()
{
Effect = SlideNavigationTransitionEffect.FromRight
});
}
private UIElement FindElementByTag(DependencyObject root, string tag)
{
int count = VisualTreeHelper.GetChildrenCount(root);
for (int i = 0; i < count; i++)
{
DependencyObject child = VisualTreeHelper.GetChild(root, i);
if (child is FrameworkElement element && element.Tag?.ToString() == tag)
return element as UIElement;
var result = FindElementByTag(child, tag);
if (result != null)
return result;
}
return null;
} But I can not make it work with Back navigation simply |
Beta Was this translation helpful? Give feedback.
-
Oh I actually don't need to depend on the private async void Section2ItemRepeater_Loaded(object sender, RoutedEventArgs e)
{
if (ViewedItem is null || ViewedUIElement is null)
return;
ConnectedAnimation animation = ConnectedAnimationService.GetForCurrentView().GetAnimation("BackConnectedAnimation");
if (animation is null)
return;
animation.TryStart(ViewedUIElement);
}
private void Section2ItemRepeater_ItemInvoked(Microsoft.UI.Xaml.Controls.ItemsView sender, Microsoft.UI.Xaml.Controls.ItemsViewItemInvokedEventArgs args)
{
var selectedCard = args.InvokedItem as ProfileCardModel;
if (selectedCard is null)
return;
var elementToAnimate = FindElementByTag(this, selectedCard.Id) as UIElement;
if (elementToAnimate is null)
return;
ViewedItem = selectedCard;
ViewedUIElement = elementToAnimate;
ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("ForwardConnectedAnimation", elementToAnimate);
Detail.Parameter pageParameter = new(selectedCard.Id, selectedCard.ImagePath);
Frame.Navigate(typeof(Detail.Page),
pageParameter,
new SlideNavigationTransitionInfo()
{
Effect = SlideNavigationTransitionEffect.FromRight
});
} |
Beta Was this translation helpful? Give feedback.
Oh I actually don't need to depend on the
TryStartConnectedAnimationAsync
to animate I can actually do this