c# - Cannot implicitly convert type 'System.EventHandler' to 'System.EventHandler<object>' for storyboard complete -
i have read few threads this, still don't know how solve in case. come java , new c#
i want attach listener when animation finishes:
mystoryboard.completed += new eventhandler(onmystoryboardcompleted); and:
private void onmystoryboardcompleted(object sender, eventargs e) { } and error in title. tried:
mystoryboard.completed += new eventhandler<object>(onmystoryboardcompleted); but get:
no overload 'onmystoryboardcompleted' matches delegate 'system.eventhandler<object>' so seems signature not compatible eventhandler<object> , couldn't find how make compatible, don't know if approach correct.
i read
understanding events , event handlers in c#
c# dynamic template implicit conversion error system.eventhandler system.eventhandler<teventargs>
defining event handler tick event of dispatchertimer in windows 8 app
but still don't find solution case.
thanks in advance.
try:
private void onmystoryboardcompleted(object sender, object e) { } and subscribe using generic eventhandler<object>:
mystoryboard.completed += new eventhandler<object>(onmystoryboardcompleted); of course, goes against .net framework convention second argument event handler should instance of eventargs (or class derived thereof). assuming running on framework, such windows 8 metro, timeline class defines completed event eventhandler<object> signature.
Comments
Post a Comment