I already read a few threads about this, but I still don't know how to solve this in my case. I come from Java and basically new to C #
I want to add a listener when the animation ends:
myStoryBoard.Completed += new EventHandler(onMyStoryBoardCompleted);
and
private void onMyStoryBoardCompleted(object sender, EventArgs e) { }
And I get an error in the name. 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 could not find how to make it compatible, I also do not know if this approach is correct.
<object>
I read
Understanding Events and Event Handlers in C #
C # Dynamic pattern of implicit conversion error from System.EventHandler to System.EventHandler <TEventArgs>
Defining a Tick event handler for DispatcherTimer in a Windows 8 application
But still no solution has been found for this case.
Thanks in advance.
Try:
private void onMyStoryBoardCompleted(object sender, object e) { }
And subscribe using the generic EventHandler<object> :
EventHandler<object>
Of course, this contradicts the .NET Framework convention that the second argument to the event handler must be an instance of EventArgs (or its derivative from the class). I assume that you are working in a different environment, such as Windows 8 Metro, whose Timeline class defines a Completed event with the signature EventHandler<object> .
EventArgs
Timeline
Completed
Source: https://habr.com/ru/post/945371/More articles:E / SQLiteLog (1893): (14) cannot open a file on line 30176 of [00bb9c9ce4] - androidHow to get an array of 1D columns and an array of 1D rows from a 2D array? (C # .NET) - arraysString caching. Memory Optimization and Reuse - c #redirect_uri and how to place callback.html in SoundCloud? - soundclouderase reCaptcha broken - php"Unrecognized selector sent to instance" when using a custom table cell - iosHow to create PixBuf from a file using Gdk3? - pythonGet word count from a string in Unicode (in any language) - javaC # Dynamic pattern of implicit conversion error from System.EventHandler to System.EventHandler - c #How to calculate types in Haskell - typesAll Articles