更新时间:2023-01-15 11:04:56
尝试:
private void onMyStoryBoardCompleted(object sender, object e)
{ }
并使用通用EventHandler<object>
订阅:
myStoryBoard.Completed += new EventHandler<object>(onMyStoryBoardCompleted);
当然,这违反了.NET Framework约定,事件处理程序的第二个参数应为EventArgs
的实例(或其派生类).我假设您正在另一个框架上运行,例如Windows 8 Metro,该框架的Timeline
类定义了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.
Try:
private void onMyStoryBoardCompleted(object sender, object e)
{ }
And subscribe using the generic EventHandler<object>
:
myStoryBoard.Completed += new EventHandler<object>(onMyStoryBoardCompleted);
Of course, this goes against the .NET Framework convention that the second argument to an event handler should be an instance of EventArgs
(or a class derived thereof). I am assuming that you are running on another framework, such as Windows 8 Metro, whose Timeline
class defines a Completed
event with an EventHandler<object>
signature.