user3263978
user3263978

Reputation: 193

No overload for 'method' matches delegates 'System.eventhandler'

I'm trying to check when one animation has finished in xaml/c# so I have used the "Completed" event which looks like

<Storyboard Completed="firstAnimationCompleted">

And I have created the method in my C# for it which looks like...

private void firstAnimationCompleted(object sender, EventArgs e)
{
    textblock.Text = "Finished";
}

so when the animation finishes it should change the specified textblock to "Finished" but for some reason I get the following error...

No overload for 'method' matches delegates 'System.eventhandler'

Any help would be appreciated! Thanks in adance

Upvotes: 1

Views: 1213

Answers (2)

Thomas Levesque
Thomas Levesque

Reputation: 292555

You didn't say it in your question, but I think your app is a Windows Store app; in WinRT, the Completed event is of type EventHandler<object>, unlike the Completed event in WPF, Silverlight and Windows Phone, which is of type EventHandler. This is why the second argument must be of type object, rather than EventArgs.

You should always mention which platform you're working on in your questions ;)

Upvotes: 3

user3263978
user3263978

Reputation: 193

ookay I've fixed it by changing the method in c# to this..

private void firstAnimationCompleted(object sender, object e)
{
    textblock.Text = "Finished";
}

although I'm not sure why considering the documentation said to put EventArgs e. So any insight to that would be nice!

Upvotes: 1

Related Questions