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); }
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; } }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); // Store the incoming parameter if (e.Parameter is SampleHost) { _host = (SampleHost)e.Parameter; } else if (e.Parameter is ContinuityTransition) { _currentTransition = (ContinuityTransition)e.Parameter; } //Hide the back button on the list page as there is no where to go back to. Windows.UI.Core.SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = Windows.UI.Core.AppViewBackButtonVisibility.Collapsed; }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); _currentTransition = (ContinuityTransition)e.Parameter; _detailsInfo = (Continuity.DetailsInfo)_currentTransition.Payload; _host = (SampleHost)_currentTransition.Host; Title.Text = _detailsInfo.thumbanil.Name; DetailText.Text = _detailsInfo.thumbanil.Description; // Enable the back button SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = _host.ContentFrame.CanGoBack ? AppViewBackButtonVisibility.Visible : AppViewBackButtonVisibility.Collapsed; SystemNavigationManager.GetForCurrentView().BackRequested += ContinuityDetails_BackRequested; }
/// <summary> /// Private constructor as Show() is responsible for creating an instance /// </summary> private ImagePopupViewer(Func <object, bool, Uri> photoGetter, string initialPhoto) { this.InitializeComponent(); _imageUriGetterFunc = photoGetter; _transition = new ContinuityTransition(); _compositor = ElementCompositionPreview.GetElementVisual(this).Compositor; this.Loaded += ImagePopupViewer_Loaded; this.Unloaded += ImagePopupViewer_Unloaded; // Bring the selected item into view _initialPhoto = initialPhoto; // Hide until the content is available this.Opacity = 0; BackgroundImage.ImageOpened += BackgroundImage_FirstOpened; // Disable the placeholder as we'll be using a transition PrimaryImage.PlaceholderDelay = TimeSpan.FromMilliseconds(-1); BackgroundImage.PlaceholderDelay = TimeSpan.FromMilliseconds(-1); BackgroundImage.LoadTimeEffectHandler = SampleImageColor; BackgroundImage.SharedSurface = true; // Create a crossfade brush to animate image transitions IGraphicsEffect graphicsEffect = new ArithmeticCompositeEffect() { Name = "CrossFade", Source1Amount = 0, Source2Amount = 1, MultiplyAmount = 0, Source1 = new CompositionEffectSourceParameter("ImageSource"), Source2 = new CompositionEffectSourceParameter("ImageSource2"), }; CompositionEffectFactory factory = _compositor.CreateEffectFactory(graphicsEffect, new[] { "CrossFade.Source1Amount", "CrossFade.Source2Amount" }); _crossFadeBrush = factory.CreateBrush(); }