/// <summary> /// Returns the <see cref="Style"/> to apply to the content during the transition. /// </summary> /// <param name="presenter">The <see cref="TransitionPresenter"/> that is managing the transition.</param> /// <param name="previousElement">The previous element.</param> /// <returns> /// The <see cref="Style"/> to apply to the "to" content during the transition. /// </returns> private Style GetCoreContentStyle(TransitionPresenter presenter, FrameworkElement previousElement) { TransitionEffect effect = this.Effect; if (null == effect) { return(null); } effect = effect.Clone() as TransitionEffect; if (null == effect) { return(null); } if (null != previousElement && 0 != previousElement.ActualHeight && 0 != previousElement.ActualWidth) { VisualBrush visualBrush = new VisualBrush(previousElement); visualBrush.Viewbox = new Rect(0, 0, previousElement.ActualWidth, previousElement.ActualHeight); visualBrush.ViewboxUnits = BrushMappingMode.Absolute; effect.OldImage = visualBrush; } else { effect.OldImage = new VisualBrush(); } Style style = new Style(typeof(FrameworkElement)); style.Setters.Add(new Setter(FrameworkElement.EffectProperty, effect)); return(style); }
private void MediaCenter_PreviewMouseDown(object sender, MouseButtonEventArgs e) { VisualBrush vbrush = new VisualBrush(this); _TransitionEffect = _TransitionEffect.Clone() as TransitionEffect; this.Effect = _TransitionEffect; // _TransitionEffect.Input = vbrush.Clone(); _TransitionEffect.OldImage = vbrush.Clone(); _TransitionEffect.BeginAnimation(TransitionEffect.ProgressProperty, _Animation); }