日期:2014-05-20  浏览次数:20823 次

问题,问题,又有问题 WPF 嵌入 WindowsFrom 控件问题
代码如下:

System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost();
  //创建 WinForme 控件
  System.Windows.Forms.NotifyIcon notifyicon = new System.Windows.Forms.NotifyIcon();

  host.Child = notifyicon;
  LayoutRoot.Children.Add(host);

这样会有个错误,不能编译,不知道各位有没有什么好方法?

错误如下:

错误 2 无法将类型“System.Windows.Forms.NotifyIcon”隐式转换为“System.Windows.Forms.Control”

谢谢

------解决方案--------------------
强制转换,OK了就结帖吧
------解决方案--------------------
那个是 Component, 加入 Container