views:

878

answers:

3

Guys, here's what I'm trying to do:

I have a Storyboard animation for an object done in Expression Blend. What I need is to be able to trigger that animation from the VB.net code. Any ideas?

Thanks,

+1  A: 

I've just translated this C# (using a tool, I suck at VB.NET)

Storyboard myStoryboard = (Storyboard)FindResource("StoryboardName");
myStoryboard.Begin();

to this

Dim myStoryboard As Storyboard = DirectCast(FindResource("StoryboardName"), Storyboard)
myStoryboard.Begin()

This assumes the x:Key of your Storyboard is StoryboardName.

If not using .NET 3.5 SP1 try

myStoryboard.Begin(me)
Ray
Thanks a lot for the quick answer!
TuxMeister
+1  A: 

If I am not mistaken, if you apply an x:Name attribute to the resource it will be accessible as a member property of the control and you can just call (assuming you used x:Name="myStoryBoard")

myStoryBoard.Begin()
Denis Troller
A: 

Now I´m getting this error while trying to debug the app:

Overload resolution failed because no accessible 'Begin' accepts this number of arguments.

"Begin" is the argument to start the Storyboard animation. Any ideas?

TuxMeister
That's weird. MSDN seems to say that there's only 12 overloads of Begin, and none accept zero parameters. However my intelli-sense shows 13, and I'm using one with no parameters and it works.
Ray
Ah, it was added in .NET 3.5 SP1
Ray
Updated my Answer.
Ray