I may have screwed something up, but It looks like you can't create and use a storyboard from code.
Storyboard board = new Storyboard();
... (set other storyboard properties)
DoubleAnimation animation = new DoubleAnimation();
... (set animation properties)
board.Children.Add(animation); // <-- can't do this, as there is no add property. Children is a TimeLineGroup with no add function.
Did I do something wrong, or is that not yet supported?
Thanks.
Pete
Developer Community Program Manager - XAML, WPF, Silverlight, .NETMF/Gadgeteer
10rem.net - Pete Brown's site and blog | twitter: @pete_brown
I work for the Developer Guidance group in Microsoft. Opinions are my own.
This doesn't work currently, you can create the appropriate XAML for your storyboard and children and then do a CreateFromXaml, see this thread for more information:
Another thing I've done is put placeholders in my XAML for the control or the page and then populate the values at run time, for example I would create a storyboard and a doubleanimation child in my XAML, and then set the to and from, and even the target
element at run time.
While waiting for a response, I ended up changing the code to use Xaml stubbed animation. If anyone is interested, you can see the results and download the code here in the quick
Silverlight Balloons project.
Pete
Developer Community Program Manager - XAML, WPF, Silverlight, .NETMF/Gadgeteer
10rem.net - Pete Brown's site and blog | twitter: @pete_brown
I work for the Developer Guidance group in Microsoft. Opinions are my own.
Psychlist1972
Contributor
6802 Points
1079 Posts
Microsoft
Moderator
Can't Create Storyboard from Scratch in Code
Jun 25, 2007 01:46 AM | LINK
SL 1.1, C#
I may have screwed something up, but It looks like you can't create and use a storyboard from code.
Storyboard board = new Storyboard();
... (set other storyboard properties)
DoubleAnimation animation = new DoubleAnimation();
... (set animation properties)
board.Children.Add(animation); // <-- can't do this, as there is no add property. Children is a TimeLineGroup with no add function.
Did I do something wrong, or is that not yet supported?
Thanks.
Pete
10rem.net - Pete Brown's site and blog | twitter: @pete_brown
I work for the Developer Guidance group in Microsoft. Opinions are my own.
Bill Reiss
Contributor
4973 Points
947 Posts
Re: Can't Create Storyboard from Scratch in Code
Jun 25, 2007 03:53 AM | LINK
This doesn't work currently, you can create the appropriate XAML for your storyboard and children and then do a CreateFromXaml, see this thread for more information:
http://silverlight.net/forums/t/842.aspx
Another thing I've done is put placeholders in my XAML for the control or the page and then populate the values at run time, for example I would create a storyboard and a doubleanimation child in my XAML, and then set the to and from, and even the target element at run time.
Bill Reiss, Coauthor of Hello! Silverlight
My blog
Psychlist1972
Contributor
6802 Points
1079 Posts
Microsoft
Moderator
Re: Re: Can't Create Storyboard from Scratch in Code
Jun 25, 2007 05:13 AM | LINK
Thanks Bill.
I'm glad I wasn't just doing something dumb :)
While waiting for a response, I ended up changing the code to use Xaml stubbed animation. If anyone is interested, you can see the results and download the code here in the quick Silverlight Balloons project.
Pete
10rem.net - Pete Brown's site and blog | twitter: @pete_brown
I work for the Developer Guidance group in Microsoft. Opinions are my own.