How to integrate a WPF control such as the Microsoft XPS Document Viewer into a Windows Forms Application
"WPF Rocks and offers a great future, we all should start to use it and change all our products over to it."
A great idea but for many of us its impossible, our main product for example has thousands and thousands of lines of code and hundreds of forms. It would be economic suicide to put all that in the bin and start again. What would be nice though, would be to develop new areas using WPF and integrate these with our Windows Forms solutions.
A short while ago I starting to look at how we were going to deliver electronic documents. PDF has been the traditional approach but Microsoft's XPS offered so much more and so I decided to follow that path. From a programming point of view it presented a number of challenges, creating, displaying, delivery etc, my solutions to which I will share with you over the coming months but for now I am going to discuss the task of displaying an XPS document using the Document Viewer that comes with Visual Studio 2008 and embedding that into a windows forms solution. In doing so, I will hopefully demonstrate just how easy it is to integrate WPF with Windows Forms.