private void InitComposition() { // Get our Compositor as well as the ScrollViewer that corresponds to // to our ListView. Then get the CompositionPropertySet that corresponds // to the ScrollViewer. var compositor = ElementCompositionPreview.GetElementVisual(this).Compositor; var scrollViewer = MainListView.GetChildOfType <ScrollViewer>(); var scrollerPropertySet = ElementCompositionPreview.GetScrollViewerManipulationPropertySet(scrollViewer); // Construct our parallax expression using the property set we got from the // ScrollViewer. Also we make sure to clamp the result so that the image doesn't // go off the screen/window. var expression = compositor.CreateExpressionAnimation("Clamp(scroller.Translation.Y * parallaxFactor, -608, 999)"); expression.SetScalarParameter("parallaxFactor", 0.3f); expression.SetReferenceParameter("scroller", scrollerPropertySet); // Assign our expression to the visual that represents our BackgroundImage. var backgroundVisual = ElementCompositionPreview.GetElementVisual(BackgroundImage); backgroundVisual.StartAnimation("Offset.Y", expression); // Get the visual that represents our HeaderTextBlock and also set up part // of our expression. var textVisual = ElementCompositionPreview.GetElementVisual(HeaderTextBlock); String progress = "Clamp(visual.Offset.Y / -100.0, 0.0, 1.0)"; // Create the expression and add in our progress string. var textExpression = compositor.CreateExpressionAnimation("Lerp(Vector3(0, 200, 0), Vector3(0, 0, 0), " + progress + ")"); textExpression.SetReferenceParameter("visual", backgroundVisual); // Assign our expression to the text visual. textVisual.StartAnimation("Offset", textExpression); }