Example #1
0
        private void ImageList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (ImageList.SelectedItem != null)
            {
                ListViewItem item        = (ListViewItem)ImageList.ContainerFromItem(ImageList.SelectedItem);
                Uri          imageSource = _imageUriGetterFunc(item.Content, true);

                if (_crossFadeBatch == null)
                {
                    // Save the previous image for a cross-fade
                    _previousSurfaceBrush.Surface     = BackgroundImage.SurfaceBrush.Surface;
                    _previousSurfaceBrush.CenterPoint = BackgroundImage.SurfaceBrush.CenterPoint;
                    _previousSurfaceBrush.Stretch     = BackgroundImage.SurfaceBrush.Stretch;

                    // Load the new background image
                    BackgroundImage.ImageOpened += BackgroundImage_ImageChanged;
                }

                // Update the images
                BackgroundImage.Source = imageSource;
                PrimaryImage.Source    = imageSource;

                if (!_transition.Completed)
                {
                    _transition.Cancel();
                }

                // Kick off a connected animation to animate from it's current position to it's new location
                CompositionImage image = VisualTreeHelperExtensions.GetFirstDescendantOfType <CompositionImage>(item);
                _transition.Initialize(this, image, null);
                _transition.Start(this, PrimaryImage, null, null);
            }
        }
        private void ThumbnailList_Click(object sender, ItemClickEventArgs e)
        {
            GridView         gridView = (GridView)sender;
            GridViewItem     item     = (GridViewItem)gridView.ContainerFromItem(e.ClickedItem);
            CompositionImage image    = VisualTreeHelperExtensions.GetFirstDescendantOfType <CompositionImage>(item);

            // We are about to transition to a new page.  Cancel any outstanding transitions.
            if (_currentTransition != null)
            {
                if (!_currentTransition.Completed)
                {
                    _currentTransition.Cancel();
                }
                _currentTransition = null;
            }

            DetailsInfo info;

            info.thumbanil = (Thumbnail)e.ClickedItem;

            // Setup the new transition and trigger the navigation
            ConnectedTransition transition = new ConnectedTransition();

            transition.Initialize(Frame, image, info);

            Frame.Navigate(typeof(CustomConnectedAnimationDetail), transition);
        }
Example #3
0
        private void CustomConnectedAnimationDetail_BackRequested(object sender, BackRequestedEventArgs e)
        {
            if (!e.Handled)
            {
                // Unregister the handler
                SystemNavigationManager.GetForCurrentView().BackRequested -= CustomConnectedAnimationDetail_BackRequested;

                // We are about to transition to a new page.  Cancel any outstanding transitions.
                if (_currentTransition != null)
                {
                    if (!_currentTransition.Completed)
                    {
                        _currentTransition.Cancel();
                    }
                    _currentTransition = null;
                }

                // Setup the new transition and trigger the navigation
                ConnectedTransition transition = new ConnectedTransition();
                transition.Initialize(_host, ThumbnailImage, _detailsInfo);

                _host.Navigate(typeof(CustomConnectedAnimation), transition);

                // We've got it handled
                e.Handled = true;
            }
        }