如何将System.Windows.DataObject强制转换为System.Windows.Forms.IDataObject? [英] How to cast the System.Windows.DataObject to System.Windows.Forms.IDataObject?

查看:81
本文介绍了如何将System.Windows.DataObject强制转换为System.Windows.Forms.IDataObject?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将wpf列表框项拖放到Windows窗体控件中.它显示一条错误消息无法将类型为"System.Windows.DataObject"的对象转换为类型为"System.Windows.Forms.IDataObject"的消息".有谁知道如何将System.Windows.DataObject强制转换为System.Windows.Forms.IDataObject?

谢谢,
Weipeng

I drag a wpf listbox item and drop to a windows forms control. It show a error message "Unable to cast object of type ‘System.Windows.DataObject’ to type’System.Windows.Forms.IDataObject’". Anyone who knows how to cast the System.Windows.DataObject to System.Windows.Forms.IDataObject?

Thanks,
Weipeng

推荐答案

这样做的原因是 System.Windows.DataObject 是WPF,并且您要将其强制转换为Windows窗体IDataObject.根本不可能,您需要将对象强制转换为 System.Windows.IDataObject .
The reason for this is that System.Windows.DataObject is WPF, and that you want to cast it to the Windows Forms IDataObject. That is simply not possible, you will need to cast the object to System.Windows.IDataObject.


这篇关于如何将System.Windows.DataObject强制转换为System.Windows.Forms.IDataObject?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆