UWP: How to animate a RenderTranform and keep it usable after that?How do I calculate someone's age in C#?How do you give a C# Auto-Property a default value?How do I enumerate an enum in C#?How do I create an Excel (.XLS and .XLSX) file in C# without installing Microsoft Office?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?How can I create a “Please Wait, Loading…” animation using jQuery?How do I generate a random int number?What is a NullReferenceException, and how do I fix it?Android: Expand/collapse animationHow do I animate constraint changes?

LED glows slightly during soldering

What steps should I take to lawfully visit the United States as a tourist immediately after visiting on a B-1 visa?

Difference between scale and grid in QGIS?

How to memorize multiple pieces?

Why isn't pressure filtration popular compared to vacuum filtration?

Find The One Element In An Array That is Different From The Others

How to know if blackberries are safe to eat?

Why does wrapping aluminium foil around my food help it keep warm, even though aluminium is a good conductor?

Why is the ladder of the LM always in the dark side of the LM?

The tensor product of two monoidal categories

Why didn't Thanos kill all the Dwarves on Nidavellir?

Extracting points from 3D plot that lie along an arbitrarily oriented line

Confirming the Identity of a (Friendly) Reviewer After the Reviews

Is "I do not want you to go nowhere" a case of "DOUBLE-NEGATIVES" as claimed by Grammarly?

Why did Harry Potter get a bedroom?

Optimization terminology: "Exact" v. "Approximate"

What is a "shilicashe?"

How were Martello towers supposed to work?

Is English unusual in having no second person plural form?

What happens to unproductive professors?

When an electron changes its spin, or any other intrinsic property, is it still the same electron?

How to drill holes in 3/8" thick steel plates?

What is the measurable difference between dry basil and fresh?

What specific instant in time in the MCU has been depicted the most times?



UWP: How to animate a RenderTranform and keep it usable after that?


How do I calculate someone's age in C#?How do you give a C# Auto-Property a default value?How do I enumerate an enum in C#?How do I create an Excel (.XLS and .XLSX) file in C# without installing Microsoft Office?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?How can I create a “Please Wait, Loading…” animation using jQuery?How do I generate a random int number?What is a NullReferenceException, and how do I fix it?Android: Expand/collapse animationHow do I animate constraint changes?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have a very simple project where I need to animate the RenderTransform of an element, and then further manipulate such transform.



Please find as a reference an MVCE here: https://github.com/cghersi/UWPExamples/tree/master/RenderTransformAnimation.



The scenario is the following: there is a ScrollViewer m_scrollView, with a Canvas content m_zoomView.
For the sake of the example we also have a CompositeTransform m_zoomViewTransform = m_zoomView.RenderTransform.



I use the following method to manipulate the RenderTransform, either with or without an animation:



private void SetEffectiveOffsetOfScrollView(Point newOffset, bool isAnimated)

if (isAnimated)

TimeSpan dur = TimeSpan.FromSeconds(0.2);
Storyboard sb = new Storyboard Duration = dur ;
DoubleAnimation animationX = new DoubleAnimation

To = newOffset.X,
Duration = dur,
AutoReverse = false
;
DoubleAnimation animationY = new DoubleAnimation

To = newOffset.Y,
Duration = dur,
AutoReverse = false
;
sb.Children.Add(animationX);
sb.Children.Add(animationY);
Storyboard.SetTarget(animationX, m_zoomViewTransform);
Storyboard.SetTarget(animationY, m_zoomViewTransform);
Storyboard.SetTargetProperty(animationX, "CompositeTransform.TranslateX");
Storyboard.SetTargetProperty(animationY, "CompositeTransform.TranslateY");

sb.Begin();
sb.Completed += (sender, o) =>

m_zoomViewTransform.TranslateX = newOffset.X;
m_zoomViewTransform.TranslateY = newOffset.Y;
;

else

m_zoomViewTransform.TranslateX = newOffset.X;
m_zoomViewTransform.TranslateY = newOffset.Y;




Now, if I use SetEffectiveOffsetOfScrollView() with isAnimated = true, I am not able to change the RenderTransform anymore, or at least I don't see any update to the UI anymore.



In the MVCE I added a button that invokes the SetEffectiveOffsetOfScrollView() method with isAnimated = true, and I added a Manipulation event to pan the m_zoomView Canvas: as soon as I click on the button, I am no more able to pan the Canvas.



How can I animate the transformation, still being able to see the updates to the UI after this action, using SetEffectiveOffsetOfScrollView() with animate=false?










share|improve this question






















  • I could reproduce this issue. I've reported to the relevant team, they're investigating it.

    – Xavier Xie - MSFT
    Mar 26 at 6:31











  • Thank you Xavier, how can I be notified upon news on this topic?

    – Cristiano Ghersi
    Mar 26 at 20:10











  • Once I got response, I would update here.

    – Xavier Xie - MSFT
    Mar 27 at 5:34

















0















I have a very simple project where I need to animate the RenderTransform of an element, and then further manipulate such transform.



Please find as a reference an MVCE here: https://github.com/cghersi/UWPExamples/tree/master/RenderTransformAnimation.



The scenario is the following: there is a ScrollViewer m_scrollView, with a Canvas content m_zoomView.
For the sake of the example we also have a CompositeTransform m_zoomViewTransform = m_zoomView.RenderTransform.



I use the following method to manipulate the RenderTransform, either with or without an animation:



private void SetEffectiveOffsetOfScrollView(Point newOffset, bool isAnimated)

if (isAnimated)

TimeSpan dur = TimeSpan.FromSeconds(0.2);
Storyboard sb = new Storyboard Duration = dur ;
DoubleAnimation animationX = new DoubleAnimation

To = newOffset.X,
Duration = dur,
AutoReverse = false
;
DoubleAnimation animationY = new DoubleAnimation

To = newOffset.Y,
Duration = dur,
AutoReverse = false
;
sb.Children.Add(animationX);
sb.Children.Add(animationY);
Storyboard.SetTarget(animationX, m_zoomViewTransform);
Storyboard.SetTarget(animationY, m_zoomViewTransform);
Storyboard.SetTargetProperty(animationX, "CompositeTransform.TranslateX");
Storyboard.SetTargetProperty(animationY, "CompositeTransform.TranslateY");

sb.Begin();
sb.Completed += (sender, o) =>

m_zoomViewTransform.TranslateX = newOffset.X;
m_zoomViewTransform.TranslateY = newOffset.Y;
;

else

m_zoomViewTransform.TranslateX = newOffset.X;
m_zoomViewTransform.TranslateY = newOffset.Y;




Now, if I use SetEffectiveOffsetOfScrollView() with isAnimated = true, I am not able to change the RenderTransform anymore, or at least I don't see any update to the UI anymore.



In the MVCE I added a button that invokes the SetEffectiveOffsetOfScrollView() method with isAnimated = true, and I added a Manipulation event to pan the m_zoomView Canvas: as soon as I click on the button, I am no more able to pan the Canvas.



How can I animate the transformation, still being able to see the updates to the UI after this action, using SetEffectiveOffsetOfScrollView() with animate=false?










share|improve this question






















  • I could reproduce this issue. I've reported to the relevant team, they're investigating it.

    – Xavier Xie - MSFT
    Mar 26 at 6:31











  • Thank you Xavier, how can I be notified upon news on this topic?

    – Cristiano Ghersi
    Mar 26 at 20:10











  • Once I got response, I would update here.

    – Xavier Xie - MSFT
    Mar 27 at 5:34













0












0








0


1






I have a very simple project where I need to animate the RenderTransform of an element, and then further manipulate such transform.



Please find as a reference an MVCE here: https://github.com/cghersi/UWPExamples/tree/master/RenderTransformAnimation.



The scenario is the following: there is a ScrollViewer m_scrollView, with a Canvas content m_zoomView.
For the sake of the example we also have a CompositeTransform m_zoomViewTransform = m_zoomView.RenderTransform.



I use the following method to manipulate the RenderTransform, either with or without an animation:



private void SetEffectiveOffsetOfScrollView(Point newOffset, bool isAnimated)

if (isAnimated)

TimeSpan dur = TimeSpan.FromSeconds(0.2);
Storyboard sb = new Storyboard Duration = dur ;
DoubleAnimation animationX = new DoubleAnimation

To = newOffset.X,
Duration = dur,
AutoReverse = false
;
DoubleAnimation animationY = new DoubleAnimation

To = newOffset.Y,
Duration = dur,
AutoReverse = false
;
sb.Children.Add(animationX);
sb.Children.Add(animationY);
Storyboard.SetTarget(animationX, m_zoomViewTransform);
Storyboard.SetTarget(animationY, m_zoomViewTransform);
Storyboard.SetTargetProperty(animationX, "CompositeTransform.TranslateX");
Storyboard.SetTargetProperty(animationY, "CompositeTransform.TranslateY");

sb.Begin();
sb.Completed += (sender, o) =>

m_zoomViewTransform.TranslateX = newOffset.X;
m_zoomViewTransform.TranslateY = newOffset.Y;
;

else

m_zoomViewTransform.TranslateX = newOffset.X;
m_zoomViewTransform.TranslateY = newOffset.Y;




Now, if I use SetEffectiveOffsetOfScrollView() with isAnimated = true, I am not able to change the RenderTransform anymore, or at least I don't see any update to the UI anymore.



In the MVCE I added a button that invokes the SetEffectiveOffsetOfScrollView() method with isAnimated = true, and I added a Manipulation event to pan the m_zoomView Canvas: as soon as I click on the button, I am no more able to pan the Canvas.



How can I animate the transformation, still being able to see the updates to the UI after this action, using SetEffectiveOffsetOfScrollView() with animate=false?










share|improve this question














I have a very simple project where I need to animate the RenderTransform of an element, and then further manipulate such transform.



Please find as a reference an MVCE here: https://github.com/cghersi/UWPExamples/tree/master/RenderTransformAnimation.



The scenario is the following: there is a ScrollViewer m_scrollView, with a Canvas content m_zoomView.
For the sake of the example we also have a CompositeTransform m_zoomViewTransform = m_zoomView.RenderTransform.



I use the following method to manipulate the RenderTransform, either with or without an animation:



private void SetEffectiveOffsetOfScrollView(Point newOffset, bool isAnimated)

if (isAnimated)

TimeSpan dur = TimeSpan.FromSeconds(0.2);
Storyboard sb = new Storyboard Duration = dur ;
DoubleAnimation animationX = new DoubleAnimation

To = newOffset.X,
Duration = dur,
AutoReverse = false
;
DoubleAnimation animationY = new DoubleAnimation

To = newOffset.Y,
Duration = dur,
AutoReverse = false
;
sb.Children.Add(animationX);
sb.Children.Add(animationY);
Storyboard.SetTarget(animationX, m_zoomViewTransform);
Storyboard.SetTarget(animationY, m_zoomViewTransform);
Storyboard.SetTargetProperty(animationX, "CompositeTransform.TranslateX");
Storyboard.SetTargetProperty(animationY, "CompositeTransform.TranslateY");

sb.Begin();
sb.Completed += (sender, o) =>

m_zoomViewTransform.TranslateX = newOffset.X;
m_zoomViewTransform.TranslateY = newOffset.Y;
;

else

m_zoomViewTransform.TranslateX = newOffset.X;
m_zoomViewTransform.TranslateY = newOffset.Y;




Now, if I use SetEffectiveOffsetOfScrollView() with isAnimated = true, I am not able to change the RenderTransform anymore, or at least I don't see any update to the UI anymore.



In the MVCE I added a button that invokes the SetEffectiveOffsetOfScrollView() method with isAnimated = true, and I added a Manipulation event to pan the m_zoomView Canvas: as soon as I click on the button, I am no more able to pan the Canvas.



How can I animate the transformation, still being able to see the updates to the UI after this action, using SetEffectiveOffsetOfScrollView() with animate=false?







c# animation uwp rendertransform






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 26 at 1:45









Cristiano GhersiCristiano Ghersi

7631 gold badge13 silver badges29 bronze badges




7631 gold badge13 silver badges29 bronze badges












  • I could reproduce this issue. I've reported to the relevant team, they're investigating it.

    – Xavier Xie - MSFT
    Mar 26 at 6:31











  • Thank you Xavier, how can I be notified upon news on this topic?

    – Cristiano Ghersi
    Mar 26 at 20:10











  • Once I got response, I would update here.

    – Xavier Xie - MSFT
    Mar 27 at 5:34

















  • I could reproduce this issue. I've reported to the relevant team, they're investigating it.

    – Xavier Xie - MSFT
    Mar 26 at 6:31











  • Thank you Xavier, how can I be notified upon news on this topic?

    – Cristiano Ghersi
    Mar 26 at 20:10











  • Once I got response, I would update here.

    – Xavier Xie - MSFT
    Mar 27 at 5:34
















I could reproduce this issue. I've reported to the relevant team, they're investigating it.

– Xavier Xie - MSFT
Mar 26 at 6:31





I could reproduce this issue. I've reported to the relevant team, they're investigating it.

– Xavier Xie - MSFT
Mar 26 at 6:31













Thank you Xavier, how can I be notified upon news on this topic?

– Cristiano Ghersi
Mar 26 at 20:10





Thank you Xavier, how can I be notified upon news on this topic?

– Cristiano Ghersi
Mar 26 at 20:10













Once I got response, I would update here.

– Xavier Xie - MSFT
Mar 27 at 5:34





Once I got response, I would update here.

– Xavier Xie - MSFT
Mar 27 at 5:34












1 Answer
1






active

oldest

votes


















1














This is due to dependency property value precedence, as described here:
https://docs.microsoft.com/en-us/windows/uwp/xaml-platform/dependency-properties-overview#dependency-property-value-precedence



In this repro, the Storyboard is still active, due to the default FillBehavior=HoldEnd on the DoubleAnimations. Since those animations are still alive, the animated value gets used, even as new local values get set on the isAnimated=false case.



The easy fix is to call sb.Stop() in the Storyboard's Completed handler, after you've set the new local values to hold. This will stop the animations, removing the Animated values they are holding, and allow the Local values to be used.






share|improve this answer























  • Thank you Mike, this is exactly what I was looking for!

    – Cristiano Ghersi
    May 12 at 1:53










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55348721%2fuwp-how-to-animate-a-rendertranform-and-keep-it-usable-after-that%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














This is due to dependency property value precedence, as described here:
https://docs.microsoft.com/en-us/windows/uwp/xaml-platform/dependency-properties-overview#dependency-property-value-precedence



In this repro, the Storyboard is still active, due to the default FillBehavior=HoldEnd on the DoubleAnimations. Since those animations are still alive, the animated value gets used, even as new local values get set on the isAnimated=false case.



The easy fix is to call sb.Stop() in the Storyboard's Completed handler, after you've set the new local values to hold. This will stop the animations, removing the Animated values they are holding, and allow the Local values to be used.






share|improve this answer























  • Thank you Mike, this is exactly what I was looking for!

    – Cristiano Ghersi
    May 12 at 1:53















1














This is due to dependency property value precedence, as described here:
https://docs.microsoft.com/en-us/windows/uwp/xaml-platform/dependency-properties-overview#dependency-property-value-precedence



In this repro, the Storyboard is still active, due to the default FillBehavior=HoldEnd on the DoubleAnimations. Since those animations are still alive, the animated value gets used, even as new local values get set on the isAnimated=false case.



The easy fix is to call sb.Stop() in the Storyboard's Completed handler, after you've set the new local values to hold. This will stop the animations, removing the Animated values they are holding, and allow the Local values to be used.






share|improve this answer























  • Thank you Mike, this is exactly what I was looking for!

    – Cristiano Ghersi
    May 12 at 1:53













1












1








1







This is due to dependency property value precedence, as described here:
https://docs.microsoft.com/en-us/windows/uwp/xaml-platform/dependency-properties-overview#dependency-property-value-precedence



In this repro, the Storyboard is still active, due to the default FillBehavior=HoldEnd on the DoubleAnimations. Since those animations are still alive, the animated value gets used, even as new local values get set on the isAnimated=false case.



The easy fix is to call sb.Stop() in the Storyboard's Completed handler, after you've set the new local values to hold. This will stop the animations, removing the Animated values they are holding, and allow the Local values to be used.






share|improve this answer













This is due to dependency property value precedence, as described here:
https://docs.microsoft.com/en-us/windows/uwp/xaml-platform/dependency-properties-overview#dependency-property-value-precedence



In this repro, the Storyboard is still active, due to the default FillBehavior=HoldEnd on the DoubleAnimations. Since those animations are still alive, the animated value gets used, even as new local values get set on the isAnimated=false case.



The easy fix is to call sb.Stop() in the Storyboard's Completed handler, after you've set the new local values to hold. This will stop the animations, removing the Animated values they are holding, and allow the Local values to be used.







share|improve this answer












share|improve this answer



share|improve this answer










answered May 10 at 17:54









Mike Crider - MSFTMike Crider - MSFT

511 bronze badge




511 bronze badge












  • Thank you Mike, this is exactly what I was looking for!

    – Cristiano Ghersi
    May 12 at 1:53

















  • Thank you Mike, this is exactly what I was looking for!

    – Cristiano Ghersi
    May 12 at 1:53
















Thank you Mike, this is exactly what I was looking for!

– Cristiano Ghersi
May 12 at 1:53





Thank you Mike, this is exactly what I was looking for!

– Cristiano Ghersi
May 12 at 1:53








Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55348721%2fuwp-how-to-animate-a-rendertranform-and-keep-it-usable-after-that%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript