/// <summary> /// Event handler for the Click event on the header. /// In response this function will trigger a Color Bloom transition animation. /// This is achieved by creating a circular solid colored visual directly underneath the /// Pivot header which was clicked, and animating its scale so that it floods a designated bounding box. /// </summary> private void Header_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { var header = sender as AppBarButton; var headerPosition = header.TransformToVisual(UICanvas).TransformPoint(new Windows.Foundation.Point(0d, 0d)); var initialBounds = new Windows.Foundation.Rect() // maps to a rectangle the size of the header { Width = header.RenderSize.Width, Height = header.RenderSize.Height, X = headerPosition.X, Y = headerPosition.Y }; var finalBounds = Window.Current.Bounds; // maps to the bounds of the current window transition.Start((Windows.UI.Color)_colorsByPivotItem[header.Name], // the color for the circlular bloom initialBounds, // the initial size and position finalBounds); // the area to fill over the animation duration // Add item to queue of transitions var pivotItem = (PivotItem)rootPivot.Items.Single(i => ((AppBarButton)((PivotItem)i).Header).Name.Equals(header.Name)); pendingTransitions.Enqueue(pivotItem); // Make the content visible immediately, when first clicked. Subsequent clicks will be handled by Pivot Control var content = (FrameworkElement)pivotItem.Content; if (content.Visibility == Visibility.Collapsed) { content.Visibility = Visibility.Visible; } }
/// <summary> /// Event handler for the Click event on the header. /// In response this function will trigger a Color Bloom transition animation. /// This is achieved by creating a circular solid colored visual directly underneath the /// Pivot header which was clicked, and animating its scale so that it floods a designated bounding box. /// </summary> private void Header_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { var header = sender as AppBarButton; var headerPosition = header.TransformToVisual(UICanvas).TransformPoint(new Windows.Foundation.Point(0d, 0d)); var initialBounds = new Windows.Foundation.Rect() // maps to a rectangle the size of the header { Width = header.RenderSize.Width, Height = header.RenderSize.Height, X = headerPosition.X, Y = headerPosition.Y }; var finalBounds = Window.Current.Bounds; // maps to the bounds of the current window transition.Start((Windows.UI.Color)_colorsByPivotItem[header.Name], // the color for the circlular bloom initialBounds, // the initial size and position finalBounds); // the area to fill over the animation duration }