InvalidCastException: 无法将类型为“System.Windows.Controls.Menu”的对象强制转换为类型“System.Windows.Controls.MenuItem”。 StackTrace: 在 DynamicClass.MainViewModel.初始化菜单事件() 在 DynamicClass.MainViewModel..ctor() 在 DynamicClass.a.<OnWindowCreated>d__7.MoveNext() --- 引发异常的上一位置中堆栈跟踪的末尾 --- 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) 在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)