【问题标题】:how to typecast System.Windows.Controls to System.Windows.Forms wpf如何将 System.Windows.Controls 类型转换为 System.Windows.Forms wpf
【发布时间】:2013-01-08 15:43:06
【问题描述】:

我正在尝试将 Windows.Controls 类型转换为 Windows.Form 但得到 Null。

private void treeView_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{       
  var tv = sender as System.Windows.Forms.TreeView;
}

我可以将System.Windows.Controls 类型转换为System.Windows.Forms 如果可以,那么如何?

【问题讨论】:

    标签: c# wpf


    【解决方案1】:

    根据 MSDN

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

    System.Windows.Forms - System.Windows.Forms 命名空间包含用于创建基于 Windows 的应用程序的类,这些类充分利用了Microsoft Windows 操作系统。

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

    【讨论】:

    • 感谢您的回复。
    猜你喜欢
    • 2011-10-06
    • 2016-03-20
    • 1970-01-01
    • 2023-02-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-12
    • 1970-01-01
    相关资源
    最近更新 更多