Esempio n. 1
0
        private void treePivot_SelectionChanged(object sender, SelectionChangedEventArgs e)

        {
            var beforeheader      = sender as Pivot;
            var rightBeforeHeader = beforeheader.SelectedItem as PivotItem;

            var header = rightBeforeHeader.Header as StackPanel;

            var headerPosition = header.TransformToVisual(UICanvas).TransformPoint(new Windows.Foundation.Point(0d, 0d));


            var initialBounds = new Windows.Foundation.Rect()
            {
                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

            //The code is super easy to understand if you set a break point here and
            //check to see what happens step by step ;)
            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)mainPivot.Items.Single(i => ((StackPanel)((PivotItem)i).Header).Name.Equals(header.Name));

            pendingTransitions.Enqueue(pivotItem);

            //This code deals with a bug that occurs when you go navigate to a new page then come back to this one.
            if (carefulPlz == true)
            {
                var item         = pendingTransitions.Dequeue();
                var headerFinish = item;
                UICanvas.Background = new SolidColorBrush((Windows.UI.Color)_colorsByPivotItem[headerFinish.Name]);
                carefulPlz          = false;
            }
            // 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;
            }
        }
Esempio n. 2
0
        private void Bloomer()
        {
            var initialBounds = new Rect  // maps to a rectangle the size of the header
            {
                Width  = 110,
                Height = 110,
                X      = 0,
                Y      = 0
            };

            var finalBounds = Window.Current.Bounds;  // maps to the bounds of the current window

            _transition.Start(Colors.Black, initialBounds, finalBounds);
        }