示例#1
0
        private void page_Loaded(object sender, RoutedEventArgs e)
        {
            this.Loaded -= this.page_Loaded;

            this.spVisual        = ElementCompositionPreview.GetElementVisual(this.spContent);
            this.btnScrollVisual = ElementCompositionPreview.GetElementVisual(this.btn_Scroll);
            this.compositor      = this.spVisual.Compositor;
            this.tracker         = InteractionTracker.Create(this.compositor);
            var tref = this.tracker.GetReference();

            var trackerTarget = ExpressionValues.Target.CreateInteractionTrackerTarget();
            var endpoint1     = InteractionTrackerInertiaRestingValue.Create(this.compositor);

            endpoint1.SetCondition(trackerTarget.NaturalRestingPosition.Y < (trackerTarget.MaxPosition.Y - trackerTarget.MinPosition.Y) / 2);
            endpoint1.SetRestingValue(trackerTarget.MinPosition.Y);
            var endpoint2 = InteractionTrackerInertiaRestingValue.Create(this.compositor);

            endpoint2.SetCondition(trackerTarget.NaturalRestingPosition.Y >= (trackerTarget.MaxPosition.Y - trackerTarget.MinPosition.Y) / 2);
            endpoint2.SetRestingValue(trackerTarget.MaxPosition.Y);
            this.tracker.ConfigurePositionYInertiaModifiers(new InteractionTrackerInertiaModifier[] { endpoint1, endpoint2 });

            this.interactionSource = VisualInteractionSource.Create(this.spVisual);
            this.interactionSource.PositionYSourceMode = InteractionSourceMode.EnabledWithInertia;
            this.tracker.InteractionSources.Add(this.interactionSource);
            this.propertySet = this.compositor.CreatePropertySet();
            this.propertySet.InsertScalar("progress", 0.0f);
            this.propertySet.StartAnimation("progress", tref.Position.Y / tref.MaxPosition.Y);
            var progress = this.propertySet.GetReference().GetScalarProperty("progress");

            this.btnScrollVisual.StartAnimation("RotationAngleInDegrees", ExpressionFunctions.Clamp(progress, 0f, 1f) * 180);
            this.btnScrollVisual.CenterPoint = new System.Numerics.Vector3((float)this.btn_Scroll.ActualWidth / 2, (float)this.btn_Scroll.ActualHeight / 2, 0);
            this.spVisual.StartAnimation("Offset.Y", -ExpressionFunctions.Clamp(progress, -0.4f, 1.4f) * tref.MaxPosition.Y);
            gdInfo_SizeChanged(this, null);
        }
示例#2
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            clampTeacherCount.Translation = new Vector3(0, -100, 0);
            clampSendButton.Translation   = new Vector3(0, -100, 0);

            var propSet    = ElementCompositionPreview.GetScrollViewerManipulationPropertySet(scrollRoot);
            var compositor = propSet.Compositor;
            var props      = compositor.CreatePropertySet();

            props.InsertScalar("progress", 0);
            props.InsertScalar("clampSize", ClampBreakPoint);

            var propScroll      = propSet.GetSpecializedReference <ManipulationPropertySetReferenceNode>();
            var propGet         = props.GetReference();
            var progressionNode = propGet.GetScalarProperty("progress");
            var clampSizeNode   = propGet.GetScalarProperty("clampSize");

            ExpressionNode progressAnim = ExpressionFunctions.Clamp(-propScroll.Translation.Y / clampSizeNode, 0, 1);

            props.StartAnimation("progress", progressAnim);

            ExpressionNode opacityNode = ExpressionFunctions.Lerp(0, 1, progressionNode);

            ElementCompositionPreview.GetElementVisual(fadeBlackHeader).StartAnimation("Opacity", opacityNode);
        }
        /// <summary>
        /// Uses Composition API to get the UIElement and sets an ExpressionAnimation
        /// The ExpressionAnimation uses the height of the UIElement to calculate an opacity value
        /// for the Header as it is scrolling off-screen. The opacity reaches 0 when the Header
        /// is entirely scrolled off.
        /// </summary>
        /// <returns><c>true</c> if the assignment was successful; otherwise, <c>false</c>.</returns>
        private bool AssignFadeAnimation()
        {
            // Confirm that Windows.UI.Xaml.Hosting.ElementCompositionPreview is available (Windows 10 10586 or later).
            if (!ApiInformation.IsMethodPresent("Windows.UI.Xaml.Hosting.ElementCompositionPreview", nameof(ElementCompositionPreview.GetScrollViewerManipulationPropertySet)))
            {
                // Just return true since it's not supported
                return(true);
            }

            if (AssociatedObject == null)
            {
                return(false);
            }

            var scroller = AssociatedObject as ScrollViewer ?? AssociatedObject.FindDescendant <ScrollViewer>();

            if (scroller == null)
            {
                return(false);
            }

            var listView = AssociatedObject as Windows.UI.Xaml.Controls.ListViewBase ?? AssociatedObject.FindDescendant <Windows.UI.Xaml.Controls.ListViewBase>();

            if (listView != null && listView.ItemsPanelRoot != null)
            {
                Canvas.SetZIndex(listView.ItemsPanelRoot, -1);
            }

            // Implicit operation: Find the Header object of the control if it uses ListViewBase
            if (HeaderElement == null && listView != null)
            {
                HeaderElement = listView.Header as UIElement;
            }

            // If no header is set or detected, return.
            if (HeaderElement == null || HeaderElement.RenderSize.Height == 0d)
            {
                return(false);
            }

            // Get the ScrollViewer's ManipulationPropertySet
            var scrollViewerManipulationPropSet = ElementCompositionPreview.GetScrollViewerManipulationPropertySet(scroller);
            var scrollPropSet = scrollViewerManipulationPropSet.GetSpecializedReference <ManipulationPropertySetReferenceNode>();

            // Use the ScrollViewer's Y offset and the header's height to calculate the opacity percentage. Clamp it between 0% and 100%
            var headerHeight      = (float)HeaderElement.RenderSize.Height;
            var opacityExpression = ExpressionFunctions.Clamp(1 - (-scrollPropSet.Translation.Y / headerHeight), 0, 1);

            // Begin animating
            var targetElement = ElementCompositionPreview.GetElementVisual(HeaderElement);

            targetElement.StartAnimation("Opacity", opacityExpression);

            return(true);
        }
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            var propSet    = ElementCompositionPreview.GetScrollViewerManipulationPropertySet(scrollRoot);
            var compositor = propSet.Compositor;
            var props      = compositor.CreatePropertySet();

            props.InsertScalar("progress", 0);
            props.InsertScalar("clampSize", 150);

            var propScroll      = propSet.GetSpecializedReference <ManipulationPropertySetReferenceNode>();
            var propGet         = props.GetReference();
            var progressionNode = propGet.GetScalarProperty("progress");
            var clampSizeNode   = propGet.GetScalarProperty("clampSize");

            ExpressionNode progressNode = ExpressionFunctions.Clamp(-propScroll.Translation.Y / clampSizeNode, 0, 1);

            props.StartAnimation("progress", progressNode);

            ExpressionNode opacityNode          = ExpressionFunctions.Lerp(1, 0, progressionNode);
            var            pnlDetailVisual      = ElementCompositionPreview.GetElementVisual(pnlDetail);
            var            pnlFeedbackForVisual = ElementCompositionPreview.GetElementVisual(pnlFeedbackFor);

            pnlDetailVisual.StartAnimation("Opacity", opacityNode);
            pnlFeedbackForVisual.StartAnimation("Opacity", opacityNode);

            ExpressionNode opacityInvertedNode    = ExpressionFunctions.Lerp(0, 1, progressionNode);
            var            headerBackgroundVisual = ElementCompositionPreview.GetElementVisual(recHeaderBackground);

            headerBackgroundVisual.StartAnimation("Opacity", opacityInvertedNode);

            ExpressionNode scaleNode      = ExpressionFunctions.Lerp(1, 0, progressionNode / 2);
            var            headerPSVisual = ElementCompositionPreview.GetElementVisual(headerPS);

            headerPSVisual.StartAnimation("Scale.X", scaleNode);
            headerPSVisual.StartAnimation("Scale.Y", scaleNode);


            ExpressionNode headerTextNode     = ExpressionFunctions.Lerp(new Vector3(0, 0, 0), new Vector3(-50f, 0, 0), progressionNode);
            var            pnlBasicInfoVisual = ElementCompositionPreview.GetElementVisual(pnlBasicInfo);

            pnlBasicInfoVisual.StartAnimation("Offset", headerTextNode);

            ExpressionNode actionButtonNode = ExpressionFunctions.Lerp(new Vector2(0, 0), new Vector2(0, 3.3f), progressionNode);
            var            sendButtonViusal = ElementCompositionPreview.GetElementVisual(btnSend);

            sendButtonViusal.StartAnimation("AnchorPoint", actionButtonNode);
        }
        private void OnPageLoaded(object sender, RoutedEventArgs e)
        {
            var animationService = ConnectedAnimationService.GetForCurrentView();
            var animation        = animationService.GetAnimation(Constants.ConnectedAnimationKey);

            if (animation != null)
            {
                animation.TryStart(CoverImage, new UIElement[] { SetImage });
            }

            // Get the PropertySet that contains the scroll values from MyScrollViewer
            _scrollerPropertySet = ElementCompositionPreview.GetScrollViewerManipulationPropertySet(MyScrollviewer);
            _compositor          = _scrollerPropertySet.Compositor;

            // Create a PropertySet that has values to be referenced in the ExpressionAnimations below
            _props = _compositor.CreatePropertySet();
            _props.InsertScalar("progress", 0);
            _props.InsertScalar("clampSize", 100);

            // Get references to our property sets for use with ExpressionNodes
            var scrollingProperties = _scrollerPropertySet.GetSpecializedReference <ManipulationPropertySetReferenceNode>();
            var props         = _props.GetReference();
            var progressNode  = props.GetScalarProperty("progress");
            var clampSizeNode = props.GetScalarProperty("clampSize");

            // Create and start an ExpressionAnimation to track scroll progress over the desired distance
            var progressAnimation = ExpressionFunctions.Clamp(-scrollingProperties.Translation.Y / clampSizeNode, 0, 1);

            _props.StartAnimation("progress", progressAnimation);

            // Get the backing visual for the header so that its properties can be animated
            var headerVisual = ElementCompositionPreview.GetElementVisual(Header);

            // Create and start an ExpressionAnimation to clamp the header's offset to keep it onscreen
            var headerTranslationAnimation = ExpressionFunctions.Conditional(progressNode < 1, 0, -scrollingProperties.Translation.Y - clampSizeNode);

            headerVisual.StartAnimation("Offset.Y", headerTranslationAnimation);

            // Create and start an ExpressionAnimation to scale the header during overpan
            var headerScaleAnimation = ExpressionFunctions.Lerp(1, 1.25f, ExpressionFunctions.Clamp(scrollingProperties.Translation.Y / 50, 0, 1));

            headerVisual.StartAnimation("Scale.X", headerScaleAnimation);
            headerVisual.StartAnimation("Scale.Y", headerScaleAnimation);

            //Set the header's CenterPoint to ensure the overpan scale looks as desired
            headerVisual.CenterPoint = new Vector3((float)(Header.ActualWidth / 2), (float)Header.ActualHeight, 0);
        }
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            var gridView = this.FindAscendant <GridView>();

            if (gridView == null)
            {
                return;
            }

            var scrollViewer    = gridView.FindDescendant <ScrollViewer>();
            var headerPresenter = (UIElement)VisualTreeHelper.GetParent((UIElement)gridView.Header);
            var headerContainer = (UIElement)VisualTreeHelper.GetParent(headerPresenter);

            Canvas.SetZIndex(headerContainer, 1);

            _scrollerPropertySet = scrollViewer.GetScrollViewerManipulationPropertySet();
            _compositor          = _scrollerPropertySet.Compositor;

            _props = _compositor.CreatePropertySet();
            _props.InsertScalar("progress", 0);
            _props.InsertScalar("clampSize", 240);
            _props.InsertScalar("scaleFactor", 0.7f);

            var scrollingProperties = _scrollerPropertySet.GetSpecializedReference <ManipulationPropertySetReferenceNode>();
            var props           = _props.GetReference();
            var progressNode    = props.GetScalarProperty("progress");
            var clampSizeNode   = props.GetScalarProperty("clampSize");
            var scaleFactorNode = props.GetScalarProperty("scaleFactor");

            ExpressionNode progressAnimation = ExpressionFunctions.Clamp(-scrollingProperties.Translation.Y / clampSizeNode, 0, 1);

            _props.StartAnimation("progress", progressAnimation);

            ExpressionNode headerScaleAnimation       = ExpressionFunctions.Lerp(1, 1.25f, ExpressionFunctions.Clamp(scrollingProperties.Translation.Y / 50, 0, 1));
            ExpressionNode headerTranslationAnimation = ExpressionFunctions.Conditional(progressNode < 1, 0, -scrollingProperties.Translation.Y - clampSizeNode);

            var headerVisual = this.ElementVisual();

            headerVisual.CenterPoint = new Vector3((float)(this.ActualWidth / 2), (float)this.ActualHeight, 0);
            headerVisual.StartAnimation("Scale.X", headerScaleAnimation);
            headerVisual.StartAnimation("Scale.Y", headerScaleAnimation);
            headerVisual.StartAnimation("Offset.Y", headerTranslationAnimation);

            ExpressionNode primaryOpacityAnimation = 1 - progressNode;

            PrimaryBackground.ElementVisual().StartAnimation("opacity", primaryOpacityAnimation);

            ExpressionNode secondaryOpacityAnimation = progressNode;

            SecondaryBackground.ElementVisual().StartAnimation("opacity", secondaryOpacityAnimation);

            ExpressionNode scaleAnimation      = ExpressionFunctions.Lerp(1, scaleFactorNode, progressNode);
            ExpressionNode opacityAnimation    = ExpressionFunctions.Clamp(1 - (progressNode * 2), 0, 1);
            Visual         autoSearchBoxVisual = SearchBox.ElementVisual();

            autoSearchBoxVisual.CenterPoint = new Vector3((float)(SearchBox.ActualWidth / 2), (float)SearchBox.ActualHeight, 0);
            autoSearchBoxVisual.StartAnimation("Scale.X", scaleAnimation);
            autoSearchBoxVisual.StartAnimation("Scale.Y", scaleAnimation);
            autoSearchBoxVisual.StartAnimation("Opacity", opacityAnimation);

            Visual         subMenuPanelVisual     = SubMenuPanel.ElementVisual();
            ExpressionNode contentOffsetAnimation = progressNode * 100;

            subMenuPanelVisual.StartAnimation("Offset.Y", contentOffsetAnimation);

            ExpressionNode searchBtnOpacityAnimation = ExpressionFunctions.Conditional(progressNode < 1, 0, 1);
            Visual         searchBtnVisual           = ElementCompositionPreview.GetElementVisual(SearchBtn);

            searchBtnVisual.StartAnimation("Opacity", searchBtnOpacityAnimation);
        }
示例#7
0
        private void InitializeExpressionAnimations()
        {
            try
            {
                // Get the PropertySet that contains the scroll values from MyScrollViewer
                var scrollerPropertySet = ElementCompositionPreview.GetScrollViewerManipulationPropertySet(AccountScrollViewer);
                var compositor          = scrollerPropertySet.Compositor;

                // Create a PropertySet that has values to be referenced in the ExpressionAnimations below
                var props = compositor.CreatePropertySet();
                props.InsertScalar("progress", 0);
                props.InsertScalar("clampSize", 88);
                props.InsertScalar("scaleFactor", 0.3f);

                // Get references to our property sets for use with ExpressionNodes
                var scrollingProperties = scrollerPropertySet.GetSpecializedReference <ManipulationPropertySetReferenceNode>();
                var properties          = props.GetReference();
                var progressNode        = properties.GetScalarProperty("progress");
                var clampSizeNode       = properties.GetScalarProperty("clampSize");
                var scaleFactorNode     = properties.GetScalarProperty("scaleFactor");

                // Create and start an ExpressionAnimation to track scroll progress over the desired distance
                var progressAnimation = ExpressionFunctions.Clamp(-scrollingProperties.Translation.Y / clampSizeNode, 0, 1);
                props.StartAnimation("progress", progressAnimation);

                // *** Scaling the header grid ***

                // Get the backing visual for the header so that its properties can be animated
                var headerVisual = ElementCompositionPreview.GetElementVisual(Header);

                // Create and start an ExpressionAnimation to clamp the header's offset to keep it onscreen
                var headerTranslationAnimation = ExpressionFunctions.Conditional(progressNode < 1, 0, -scrollingProperties.Translation.Y - clampSizeNode);
                headerVisual.StartAnimation("Offset.Y", headerTranslationAnimation);

                // Create and start an ExpressionAnimation to scale the header during overpan
                var headerScaleAnimation = ExpressionFunctions.Lerp(1, 1.25f, ExpressionFunctions.Clamp(scrollingProperties.Translation.Y / 50, 0, 1));
                headerVisual.StartAnimation("Scale.X", headerScaleAnimation);
                headerVisual.StartAnimation("Scale.Y", headerScaleAnimation);

                //Set the header's CenterPoint to ensure the overpan scale looks as desired
                headerVisual.CenterPoint = new Vector3((float)(Header.ActualWidth / 2), (float)Header.ActualHeight, 0);

                // *** Animating the account logo ***

                // Get the backing visual for the account logo visual so that its properties can be animated
                var accountLogoVisual = ElementCompositionPreview.GetElementVisual(HeaderAccountLogo);

                // Create and start an ExpressionAnimation to scale the account logo with scroll position
                var accountLogoScaleAnimation = ExpressionFunctions.Lerp(1, scaleFactorNode, progressNode);
                accountLogoVisual.StartAnimation("Scale.X", accountLogoScaleAnimation);
                accountLogoVisual.StartAnimation("Scale.Y", accountLogoScaleAnimation);

                // *** Animating the title ***

                // Get the backing visual for the title visual so that its properties can be animated
                var titleVisual = ElementCompositionPreview.GetElementVisual(HeaderTitle);

                // Create and start an ExpressionAnimation to scale the title with scroll position
                var titleOffsetAnimation = progressNode * -88;
                titleVisual.StartAnimation("Offset.X", titleOffsetAnimation);

                // *** Animating the subtitle ***

                // Get the backing visual for the subtitle visual so that its properties can be animated
                var subtitleVisual = ElementCompositionPreview.GetElementVisual(HeaderSubtitle);

                // Create and start an ExpressionAnimation to scale the subtitle with scroll position
                var subtitleScaleAnimation = ExpressionFunctions.Lerp(1, scaleFactorNode, progressNode);
                subtitleVisual.StartAnimation("Scale.X", subtitleScaleAnimation);
                subtitleVisual.StartAnimation("Scale.Y", subtitleScaleAnimation);

                // Create an ExpressionAnimation that moves between 1 and 0 with scroll progress, to be used for subtitle opacity
                var subtitleOpacityAnimation = ExpressionFunctions.Clamp(1 - (progressNode * 2), 0, 1);
                subtitleVisual.StartAnimation("Opacity", subtitleOpacityAnimation);

                // *** Animating the editable subtitle ***

                // Get the backing visual for the subtitle visual so that its properties can be animated
                var editableSubtitleVisual = ElementCompositionPreview.GetElementVisual(HeaderEditableSubtitle);

                // Create and start an ExpressionAnimation to scale the subtitle with scroll position
                var editableSubtitleScaleAnimation = ExpressionFunctions.Lerp(1, scaleFactorNode, progressNode);
                editableSubtitleVisual.StartAnimation("Scale.X", editableSubtitleScaleAnimation);
                editableSubtitleVisual.StartAnimation("Scale.Y", editableSubtitleScaleAnimation);

                // Create an ExpressionAnimation that moves between 1 and 0 with scroll progress, to be used for subtitle opacity
                var editableSubtitleOpacityAnimation = ExpressionFunctions.Clamp(1 - (progressNode * 2), 0, 1);
                editableSubtitleVisual.StartAnimation("Opacity", editableSubtitleOpacityAnimation);

                // *** Animating the buttons bar ***

                // Get the backing visual for the buttons bar visual so that its properties can be animated
                var buttonsBarVisual = ElementCompositionPreview.GetElementVisual(HeaderButtonsBar);

                // Create and start an ExpressionAnimation to scale the buttons bar with scroll position
                var buttonsBarOffsetAnimation = progressNode * -88;
                buttonsBarVisual.StartAnimation("Offset.Y", buttonsBarOffsetAnimation);

                // Create an ExpressionAnimation that moves between 1 and 0 with scroll progress, to be used for buttons bar opacity
                var buttonsBarOpacityAnimation = ExpressionFunctions.Clamp(1 - (progressNode * 2), 0, 1);
                buttonsBarVisual.StartAnimation("Opacity", buttonsBarOpacityAnimation);

                // *** Animating the header content ***

                // Get the backing visual for the header content visual so that its properties can be animated
                var headerContentVisual = ElementCompositionPreview.GetElementVisual(HeaderContent);

                // When the header stops scrolling it is 88 pixels offscreen. We want the text header to end up with 24 pixels of its content
                // offscreen which means it needs to go from offset 0 to 88 as we traverse through the scrollable region
                var headerContentOffsetAnimation = progressNode * 88;
                headerContentVisual.StartAnimation("Offset.Y", headerContentOffsetAnimation);
            }
            catch
            {
            }
        }
        private void MainInformationPage_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            ApplicationViewTitleBar formattableTitleBar = ApplicationView.GetForCurrentView().TitleBar;

            formattableTitleBar.ButtonBackgroundColor         = Colors.Transparent;
            formattableTitleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
            CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar;

            coreTitleBar.ExtendViewIntoTitleBar = true;

            // Update the ZIndex of the header container so that the header is above the items when scrolling
            Canvas.SetZIndex(Header, 1);

            // Get the PropertySet that contains the scroll values from the ScrollViewer
            _scrollerPropertySet = ElementCompositionPreview.GetScrollViewerManipulationPropertySet(scrollViewer);
            _compositor          = _scrollerPropertySet.Compositor;

            // Create a PropertySet that has values to be referenced in the ExpressionAnimations below
            _props = _compositor.CreatePropertySet();
            _props.InsertScalar("progress", 0);
            _props.InsertScalar("clampSize", 150);
            _props.InsertScalar("scaleFactor", 0.7f);

            // Get references to our property sets for use with ExpressionNodes
            var scrollingProperties = _scrollerPropertySet.GetSpecializedReference <ManipulationPropertySetReferenceNode>();
            var props         = _props.GetReference();
            var progressNode  = props.GetScalarProperty("progress");
            var clampSizeNode = props.GetScalarProperty("clampSize");

            // Create and start an ExpressionAnimation to track scroll progress over the desired distance
            ExpressionNode progressAnimation = ExpressionFunctions.Clamp(-scrollingProperties.Translation.Y / clampSizeNode, 0, 1);

            _props.StartAnimation("progress", progressAnimation);

            // Get the backing visual for the header so that its properties can be animated
            headerVisual = ElementCompositionPreview.GetElementVisual(Header);

            // Create and start an ExpressionAnimation to clamp the header's offset to keep it onscreen
            ExpressionNode headerTranslationAnimation = ExpressionFunctions.Conditional(progressNode < 1, 0, -scrollingProperties.Translation.Y - clampSizeNode);

            headerVisual.StartAnimation("Offset.Y", headerTranslationAnimation);

            // Create and start an ExpressionAnimation to scale the header during overpan
            ExpressionNode headerScaleAnimation = ExpressionFunctions.Lerp(1, 1.25f, ExpressionFunctions.Clamp(scrollingProperties.Translation.Y / 50, 0, 1));

            headerVisual.StartAnimation("Scale.X", headerScaleAnimation);
            headerVisual.StartAnimation("Scale.Y", headerScaleAnimation);

            //Set the header's CenterPoint to ensure the overpan scale looks as desired
            headerVisual.CenterPoint = new Vector3((float)(Header.ActualWidth / 2), (float)Header.ActualHeight, 0);

            ExpressionNode OpacityAnimation = ExpressionFunctions.Clamp(1 - (progressNode * 2), 0, 1);

            Visual profileVisual = ElementCompositionPreview.GetElementVisual(ProfileImage);

            profileVisual.StartAnimation("Opacity", OpacityAnimation);

            Visual subtitleVisual = ElementCompositionPreview.GetElementVisual(SubtitleBlock);

            subtitleVisual.StartAnimation("Opacity", OpacityAnimation);

            // Get the backing visuals for the text and button containers so that their properites can be animated
            Visual buttonVisual = ElementCompositionPreview.GetElementVisual(ButtonPanel);

            ExpressionNode buttonOffsetAnimation = progressNode * -14;

            buttonVisual.StartAnimation("Offset.Y", buttonOffsetAnimation);
        }