Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/321.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何从wpf互操作访问winforms数据?_C#_Wpf_Winforms_Winforms Interop - Fatal编程技术网

C# 如何从wpf互操作访问winforms数据?

C# 如何从wpf互操作访问winforms数据?,c#,wpf,winforms,winforms-interop,C#,Wpf,Winforms,Winforms Interop,我的解决方案中有两个项目 -WindowsFormsApplication8 -WpfControlLibrary1 我正在使用WPF Interoperability中的ElementHost从WpfControlLibrary1托管UserControl1 _________________________ Form1 - [] x | ------------------------- .......... | label1 | // label

我的解决方案中有两个项目

-WindowsFormsApplication8
-WpfControlLibrary1
我正在使用WPF Interoperability中的ElementHost从WpfControlLibrary1托管UserControl1

_________________________
Form1             - [] x |
-------------------------

  ..........
  | label1 |  // label
  ..........

// elementHost1 
// wpf control has one 
// button and nothing else
   ____________
  |            |
  |  ClickMe1  |
  |____________|

__________________________
现在,


你好
private void b单击(对象发送方,路由目标)
{
MessageBox.Show();//此msgbox
}

我希望“ThisMSGBox”显示label1的内容


我该怎么做?

我更改了答案。本网站可用于两种方式:


@pipelinecache请发布一个没有它我简直无法理解的例子!!:)嗨,大卫,是的,我可以,只需要几分钟。等等。谢谢,我只希望我有更多的时间写博客。
<Canvas>
    <Button Click="btnclick">hello</Button>
</Canvas>

private void btnclick(object sender, RoutedEventArgs e)
{
    MessageBox.Show(); // this msgbox
}