如何将System.Windows.Controls强制转换为System.Windows.Forms wpf

时间:2013-01-08 07:36:40

标签: c# wpf

我正在尝试将{Case Windows.Controls Windows.Form添加到private void treeView_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { var tv = sender as System.Windows.Forms.TreeView; } 但是获得Null。

System.Windows.Controls

我可以输入System.Windows.Forms至{{1}},如果是,那么如何?

1 个答案:

答案 0 :(得分:5)

根据MSDN

windows.controls - System.Windows命名空间包含Windows Presentation Foundation(WPF)应用程序中使用的类型,包括动画客户端,用户界面控件,数据绑定和类型转换。 System.Windows.Forms及其子命名空间用于开发Windows窗体应用程序。

System.Windows.Forms - System.Windows.Forms命名空间包含用于创建基于Windows的应用程序的类,它们充分利用了可用的丰富用户界面功能Microsoft Windows操作系统。

所以你真正想要的是根本不可能的。

相关问题