private void ItemsGridView_ItemClick(object sender, ItemClickEventArgs e)
        {
            ConnectedAnimationData.AnimationIsEnabled = enableAnimation.IsChecked.GetValueOrDefault();
            // On vérifie si on utilise la connnected animation
            if (ConnectedAnimationData.AnimationIsEnabled)
            {
                var container = ItemsGridView.ContainerFromItem(e.ClickedItem) as GridViewItem;
                if (container != null)
                {
                    var root  = (FrameworkElement)container.ContentTemplateRoot;
                    var image = (UIElement)root.FindName("ImageItem");
                    ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("Image", image);
                }
            }

            var item = (Thumbnail)e.ClickedItem;

            // Add a fade out effect
            Transitions = new TransitionCollection
            {
                new ContentThemeTransition()
            };
            _navigatedUri = item.ImageUrl;
            //ConnectedAnimationData.CurrentThumbnail = item;
            Frame.Navigate(typeof(ConnectedAnimationDetail), item);
        }
        private void enableImplicitAnimation_Checked(object sender, RoutedEventArgs e)
        {
            if (ItemsGridView != null)
            {
                foreach (var item in ItemsGridView.Items)
                {
                    var container     = ItemsGridView.ContainerFromItem(item) as GridViewItem;
                    var elementVisual = ElementCompositionPreview.GetElementVisual(container);

                    if (enableImplicitAnimation.IsChecked.GetValueOrDefault())
                    {
                        elementVisual.ImplicitAnimations = _elementImplicitAnimation;
                    }
                    else
                    {
                        elementVisual.ImplicitAnimations = null;
                    }
                }
            }
        }
        private void ItemsGridView_ItemClick(object sender, ItemClickEventArgs e)
        {
            var container = ItemsGridView.ContainerFromItem(e.ClickedItem) as GridViewItem;

            if (container != null)
            {
                var root  = (FrameworkElement)container.ContentTemplateRoot;
                var image = (UIElement)root.FindName("Image");

                ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("Image", image);
            }

            var item = (Thumbnail)e.ClickedItem;

            // Add a fade out effect
            Transitions = new TransitionCollection();
            Transitions.Add(new ContentThemeTransition());

            Frame.Navigate(typeof(ConnectedAnimationDetail), _navigatedUri = item.ImageUrl);
        }
        private async void ItemsGridView_Loaded(object sender, RoutedEventArgs e)
        {
            if (ConnectedAnimationData.AnimationIsEnabled)
            {
                if (_navigatedUri != null)
                {
                    //récupération de l'animation
                    var animation = ConnectedAnimationService.GetForCurrentView().GetAnimation("Image");
                    if (animation != null)
                    {
                        var item = ViewModel.Items.First(compare => compare.ImageUrl == _navigatedUri);

                        //on scroll vers l'item
                        ItemsGridView.ScrollIntoView(item, ScrollIntoViewAlignment.Default);

                        await Task.Yield();

                        var container = ItemsGridView.ContainerFromItem(item) as GridViewItem;
                        if (container != null)
                        {
                            var root  = (FrameworkElement)container.ContentTemplateRoot;
                            var image = (Image)root.FindName("ImageItem");
                            image.Opacity = 1;
                            //on lance l'animation
                            animation.TryStart(image);
                        }
                        else
                        {
                            animation.Cancel();
                        }
                    }

                    _navigatedUri = null;
                }
            }
        }
        private void ItemsGridView_Loaded(object sender, RoutedEventArgs e)
        {
            if (_navigatedUri != null)
            {
                // May be able to perform backwards Connected Animation
                var animation = ConnectedAnimationService.GetForCurrentView().GetAnimation("Image");
                if (animation != null)
                {
                    var item = Model.Items.Where(compare => compare.ImageUrl == _navigatedUri).First();

                    ItemsGridView.ScrollIntoView(item, ScrollIntoViewAlignment.Default);
                    ItemsGridView.UpdateLayout();

                    var container = ItemsGridView.ContainerFromItem(item) as GridViewItem;
                    if (container != null)
                    {
                        var root  = (FrameworkElement)container.ContentTemplateRoot;
                        var image = (Image)root.FindName("Image");

                        // Wait for image opened. In future Insider Preview releases, this won't be necessary.
                        image.Opacity      = 0;
                        image.ImageOpened += (sender_, e_) =>
                        {
                            image.Opacity = 1;
                            animation.TryStart(image);
                        };
                    }
                    else
                    {
                        animation.Cancel();
                    }
                }

                _navigatedUri = null;
            }
        }