We're considering converting our WinForms application to a WPF application. Part of the reason is that WPF/XAML seem to be the future. We are also using third party controls that we would like to be able to phase out. Making this conversion seems like a pretty big and time consuming undertaking, though. Would it make sense to develop XAML controls that could be used in our WinForms application as a first step in the process? My thinking is that the same controls would then be used in the WPF application and all of the look, feel, and functionality would be built into the controls in either environment.

  • 2
    There have been numerous questions over the years on Stack Overflow on this very theme. It might be useful if you searched those out. If they don't answer your questions then that would be a good time to ask here. – ChrisF Jun 7 '12 at 20:52
  • Use an ElementHost . ---------- Some code (you don't need all of it.) Questions on StackOverflow about ElementHost. – User42 Nov 18 '15 at 11:28

Have you considered doing it the other way round? If your end goal is to convert to WPF completely, you could start by setting up WPF application which hosts your WinForms control. Then you could replace WinForms controls one by one over time. WPF can be quite different from WinForms and you might want to tackle some architectural issues first such as navigation.

The preferred pattern for building WPF apps is Model-View-ViewModel. I suggest doing some prototyping to get to know it if you aren't familiar with it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.