private void HidePivotHeadersControl() { _pivotHeadersControl = _pivotHeadersControl ?? VisualTreeExtensions.FindChildOfType <PivotHeadersControl>(Items); if (_pivotHeadersControl == null) { return; } _pivotHeadersControl.RenderTransform = new TranslateTransform(); _pivotHeadersControl.CacheMode = new BitmapCache(); Items.IsLocked = true; var storyboard = new Storyboard { BeginTime = TimeSpan.FromSeconds(0.2) }; var transformAnimaion2 = new DoubleAnimation { Duration = TimeSpan.FromSeconds(0.2), From = 0.0, To = -72.0, EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseIn, Exponent = 6.0 } }; Storyboard.SetTarget(transformAnimaion2, _pivotHeadersControl); Storyboard.SetTargetProperty(transformAnimaion2, new PropertyPath("(UIElement.RenderTransform).(TranslateTransform.Y)")); storyboard.Children.Add(transformAnimaion2); var opacityAnimaion2 = new DoubleAnimation { Duration = TimeSpan.FromSeconds(0.2), From = 1.0, To = 0.0 }; Storyboard.SetTarget(opacityAnimaion2, _pivotHeadersControl); Storyboard.SetTargetProperty(opacityAnimaion2, new PropertyPath("Opacity")); storyboard.Children.Add(opacityAnimaion2); var opacityAnimaion = new DoubleAnimation { Duration = TimeSpan.FromSeconds(0.2), From = 0.0, To = 1.0 }; Storyboard.SetTarget(opacityAnimaion, SelectionCaption); Storyboard.SetTargetProperty(opacityAnimaion, new PropertyPath("Opacity")); storyboard.Children.Add(opacityAnimaion); Execute.BeginOnUIThread(storyboard.Begin); }
private void ShowPivotHeadersControl() { _pivotHeadersControl = _pivotHeadersControl ?? VisualTreeExtensions.FindChildOfType <PivotHeadersControl>(Items); if (_pivotHeadersControl == null) { return; } var storyboard = new Storyboard(); var transformAnimaion2 = new DoubleAnimation { From = -72.0, To = 0.0, Duration = TimeSpan.FromSeconds(0.2), EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut, Exponent = 6.0 } }; Storyboard.SetTarget(transformAnimaion2, _pivotHeadersControl); Storyboard.SetTargetProperty(transformAnimaion2, new PropertyPath("(UIElement.RenderTransform).(TranslateTransform.Y)")); storyboard.Children.Add(transformAnimaion2); var opacityAnimaion2 = new DoubleAnimation { From = 0.0, To = 1.0, Duration = TimeSpan.FromSeconds(0.2) }; Storyboard.SetTarget(opacityAnimaion2, _pivotHeadersControl); Storyboard.SetTargetProperty(opacityAnimaion2, new PropertyPath("Opacity")); storyboard.Children.Add(opacityAnimaion2); var opacityAnimaion = new DoubleAnimation { From = 1.0, To = 0.0, Duration = TimeSpan.FromSeconds(0.2) }; Storyboard.SetTarget(opacityAnimaion, SelectionCaption); Storyboard.SetTargetProperty(opacityAnimaion, new PropertyPath("Opacity")); storyboard.Children.Add(opacityAnimaion); storyboard.Completed += (o, e) => { Items.IsLocked = false; }; Execute.BeginOnUIThread(storyboard.Begin); }
private void FadeOutHeaders() { if (_header == null) { _header = FindHeader(this); } CreateAnimationInformation(); foreach (HeaderAnimationInfo anim in _animInfo) { anim.opacityAnimator.GoTo( 0.0, _animTime ); anim.transformAnimator.GoTo( _animOffset + anim.originalX, _animTime ); } }
private void FadeOutHeaders() { if (_header == null) { _header = FindHeader(this); } CreateAnimationInformation(); foreach (HeaderAnimationInfo anim in _animInfo) { // headerItem should not be hittestable when it is faded out. anim.headerItem.IsHitTestVisible = false; anim.opacityAnimator.GoTo( 0.0, _animTime ); anim.transformAnimator.GoTo( _animOffset + anim.originalX, _animTime ); } }
private void FadeOutHeaders() { if (_header == null) { _header = FindHeader(this); } CreateAnimationInformation(); foreach (HeaderAnimationInfo anim in _animInfo) { // headerItem should not be hittestable when it is faded out. anim.headerItem.IsHitTestVisible = false; anim.opacityAnimator.GoTo( 0.0, _animTime ); anim.transformAnimator.GoTo( _animOffset + anim.originalX, _animTime ); } }
private void FadeOutHeaders() { if (_header == null) { _header = FindHeader(this); } CreateAnimationInformation(); foreach (HeaderAnimationInfo anim in _animInfo) { anim.opacityAnimator.GoTo( 0.0, _animTime ); anim.transformAnimator.GoTo( _animOffset + anim.originalX, _animTime ); } }
/// <summary> /// Returns the set of weak references to the items /// that must be animated. /// </summary> /// <returns> /// A set of weak references to items sorted by their feathering index. /// </returns> private static IList <WeakReference> GetTargetsToAnimate() { List <WeakReference> references; List <WeakReference> targets = new List <WeakReference>(); PhoneApplicationPage page = null; PhoneApplicationFrame frame = Application.Current.RootVisual as PhoneApplicationFrame; if (frame != null) { page = frame.Content as PhoneApplicationPage; } if (page == null) { return(null); } if (!_pagesToReferences.TryGetValue(page, out references)) { return(null); } foreach (WeakReference r in references) { FrameworkElement target = r.Target as FrameworkElement; // If target is null, skip. if (target == null) { continue; } // If target is not on the screen, skip. if (!IsOnScreen(target)) { continue; } ListBox listBox = r.Target as ListBox; LongListSelector longListSelector = r.Target as LongListSelector; Pivot pivot = r.Target as Pivot; if (listBox != null) { // If the target is a ListBox, feather its items individually. ItemsControlExtensions.GetItemsInViewPort(listBox, targets); } else if (longListSelector != null) { #if WP7 // If the target is a LongListSelector, feather its items individually. ListBox child = TemplatedVisualTreeExtensions.GetFirstLogicalChildByType <ListBox>(longListSelector, false); if (child != null) { ItemsControlExtensions.GetItemsInViewPort(child, targets); } #else LongListSelectorExtensions.GetItemsInViewPort(longListSelector, targets); #endif } else if (pivot != null) { // If the target is a Pivot, feather the title and the headers individually. ContentPresenter title = TemplatedVisualTreeExtensions.GetFirstLogicalChildByType <ContentPresenter>(pivot, false); if (title != null) { targets.Add(new WeakReference(title)); } PivotHeadersControl headers = TemplatedVisualTreeExtensions.GetFirstLogicalChildByType <PivotHeadersControl>(pivot, false); if (headers != null) { targets.Add(new WeakReference(headers)); } } else { // Else, feather the target as a whole. targets.Add(r); } } return(targets); }