示例#1
0
        /// <summary>Handles the Click event of the BackButton control.</summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private async void BackButton_Click(object sender, RoutedEventArgs e)
        {
            ConnectedAnimation animation = ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("backwardsAnimation", SmokeGrid.Children[0]);

            animation.Completed += Animation_Completed;

            Collection.ScrollIntoView(_storedItem, ScrollIntoViewAlignment.Default);
            Collection.UpdateLayout();

            if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 7))
            {
                animation.Configuration = new DirectConnectedAnimationConfiguration();
            }

            await Collection.TryStartConnectedAnimationAsync(animation, _storedItem, "connectedElement");
        }
示例#2
0
        private void OnLoaded(AdaptiveGridView adaptiveGrid)
        {
            IsMultiselectionEnable = false;

            if (adaptiveGrid == null || LastSelectedItem == null)
            {
                return;
            }

            var selectedItem = Items.FirstOrDefault(item => item.Item.Id == LastSelectedItem.Item.Id);

            if (selectedItem == null)
            {
                return;
            }

            ConnectedAnimation animation = ConnectedAnimationService.GetForCurrentView().GetAnimation(Constants.ConnectedAnimationKey);

            if (animation != null)
            {
                adaptiveGrid.ScrollIntoView(selectedItem, ScrollIntoViewAlignment.Default);
                adaptiveGrid.UpdateLayout();

                var containerObject = adaptiveGrid.ContainerFromItem(selectedItem);

                if (containerObject is GridViewItem container)
                {
                    var root  = (FrameworkElement)container.ContentTemplateRoot;
                    var image = (Image)root.FindName("SourceImage");
                    animation.TryStart(image);
                }
                else
                {
                    animation.Cancel();
                }
            }

            LastSelectedItem = null;
        }