解决方案可以参照:https://stackoverflow.com/questions/12769264/openclipboard-failed-when-copy-pasting-data-from-wpf-datagrid
关键的问题在于 Clipboard.SetText() 方法会触发异常。
方案一:
It is a bug in the WPF Clipboard handler. You need to handle the unhandled exception in the Application.DispatcherUnhandledException event.
Add this attribute to the Application
element in your App.xaml
DispatcherUnhandledException="Application_DispatcherUnhandledException"
Add this code to your App.xaml.cs file
void Application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { var comException =