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 continuity transition 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);
            }
        }
Пример #2
0
        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
            ContinuityTransition transition = new ContinuityTransition();

            transition.Initialize(_host, image, info);
            _host.ContentFrame.Navigate(typeof(ContinuityDetails), transition);
        }
Пример #3
0
        private void ContinuityDetails_BackRequested(object sender, BackRequestedEventArgs e)
        {
            if (!e.Handled)
            {
                // Unregister the handler
                SystemNavigationManager.GetForCurrentView().BackRequested -= ContinuityDetails_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
                ContinuityTransition transition = new ContinuityTransition();
                transition.Initialize(_host, ThumbnailImage, _detailsInfo);
                _host.ContentFrame.Navigate(typeof(Continuity), transition);

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