开发者

How to access winforms data from wpf interop?

开发者 https://www.devze.com 2022-12-14 13:39 出处:网络
There are 2 projects in my Solution. -WindowsFormsApplication8 -WpfControlLibrary1 I am using ElementHost from WPF Interoperability to host UserControl1 from the WpfControlLibrary1.

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,

&l开发者_开发问答t;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?


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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消