4
Vote

Setting a transition's duration

description

I can't find an obvious way of setting the duration of a transition. I have a TransitionalElement on a window and I wish to initialise it with a single Transition which is used everytime the 'Content' changes.
 
In my Window's constructor, I initialise the TransitionalElement as follows:
 
transitionElement.Content = new PageOne();
 
FadeAndBlurTransition transition = new FadeAndBlurTransition();
transition.Duration = new Duration(new TimeSpan(0, 0, 1));
transitionElement.Transition = transition;
 
The above code throws an exception. Could this be because I am initialising this in the wrong place?
 
An ideal interface would see an initialising constructor added to FadeAndBlurTransition (and other transitions too) where you could pass in the desired duration, i.e:
 
FadeAndBlurTransition transition = new FadeAndBlurTransition( new Duration( new TimeSpan( 0, 0, 1 ) ) );
 
I also don't like the fact that I have to create a new TimeSpan object within the constructor of a new Duration object when you set the duration of a transition. Ideally the initialising constructor would accept the duration in seconds, and would do the appropriate conversion internally.

comments

james_bird wrote Jul 30, 2008 at 11:57 AM

The exception that is being thrown is "CTP1 does not support changing the duration of this transition". If it isn't possible to change the duration of the transition after it has been created, would it be possible to initialise the duration on construction?

wrote Aug 7, 2008 at 7:17 PM

wrote Sep 2, 2008 at 5:35 PM

CommandFusion wrote Jun 23, 2009 at 11:16 AM

Is there any way at all to change a transition duration via code? The only way I can see is via XAML. All my transitions are being created at runtime dynamically, and the duration needs to be configurable.

Does this project get any attention anymore? :(

wrote Feb 21, 2011 at 7:52 AM

wrote Feb 14, 2013 at 7:30 PM