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

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현