I have read already a few threads about this, but I still don't know how to solve it in my case. I come from Java and mostly new to C#
I want to attach listener when animation finishes:
myStoryBoard.Completed += new EventHandler(onMyStoryBoardCompleted);
And:
private void onMyStoryBoardCompleted(object sender, EventArgs e)
{
}
And I get the error in the title. I tried:
myStoryBoard.Completed += new EventHandler<object>(onMyStoryBoardCompleted);
But then I get:
no overload for 'onMyStoryBoardCompleted' matches delegate 'System.EventHandler<object>'
So it seems that the signature is not compatible with EventHandler<object>
and I couldn't find how to make it compatible, I also don't know if this approach is correct.
I read
Understanding events and event handlers in C#
defining event handler for Tick event of DispatcherTimer in windows 8 app
But still don't find the solution for this case.
Thanks in advance.
myStoryBoard.Completed += new EventHandler(onMyStoryBoardCompleted);
should workTimeline
derived, theCompleted
should be defined as type EventHandler, which means this should compile without error.EventHandler<object>
.