How to access winforms data from wpf interop?

安稳与你 提交于 2019-12-12 02:45:53

问题


There are 2 projects in my Solution.

-WindowsFormsApplication8
-WpfControlLibrary1

I am using ElementHost from WPF Interoperability to host UserControl1 from the WpfControlLibrary1.

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

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

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

__________________________

Now,

<Canvas>
    <Button Click="btnclick">hello</Button>
</Canvas>

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


I want "this msgbox" to show contents of label1.

How do I do this?


回答1:


I changed my answer. This site is usefull for you to do both ways:

http://sachabarber.net/?p=149



来源:https://stackoverflow.com/questions/1951441/how-to-access-winforms-data-from-wpf-interop

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!