Chapter 20. Interoperability

 

This chapter covers:

  • Using Windows Forms controls in WPF
  • Using ActiveX and C++ in WPF
  • Using WPF in Windows Forms
  • Using Apple IIe software via Amiga emulation of a PDP-11

In a perfect world, there would be no legacy. Roving bands of highly intelligent lemurs would rewrite all your code in the middle of the night using the latest technology, and would leave a mint on your chair. To date, though, we’ve barely managed to train the lemurs to retype the works of Shakespeare. And they keep misspelling Hamlet.[1]

1 We think this is more spite than inability.

So, here we are. You might want to use WPF for some things, but either you have an old application that’s too big to rewrite right now, or you have one or two custom controls that you want to use in our new WPF application. These are the scenarios we’re going to address in detail:

  • Using Windows Forms controls inside WPF
  • Using other stuff (ActiveX, C++/MFC) inside WPF
  • Using WPF inside Windows Forms

Aside from the obvious usefulness of being able to do these things, there’s another reason why interoperability is important—it makes it possible to start using WPF now, rather than waiting until you can do a full rewrite.

20.1. Using Windows Forms controls in WPF

20.2. Embedding ActiveX and C++ in WPF

20.3. Using WPF in Windows Forms

20.4. Summary

sitemap