Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WinForm Conversion To Wpf [duplicate]

Tags:

winforms

wpf

Can I Convert my whole WinForm Application to wpf application?. I wants to convert my Accounting Software to Wpf Is it possible?.

like image 200
mahesh Avatar asked Apr 13 '11 15:04

mahesh


2 Answers

No - there is no direct translation from Windows Forms to WPF - in addition, doing this directly would be poor, and lead to a very poorly designed WPF application.

I discuss this in depth in my series on WPF with MVVM - in particular, "Part 3" shows what happens when you write WPF using the same manner as typical Windows Forms applications, but then I go onto show why this is a bad idea in general.

WPF, at its core, is built upon a very different programming paradigm than Windows Forms. It would be better to separate out your business logic in Windows Forms, then write a new View layer in WPF to work with the logic.

like image 197
Reed Copsey Avatar answered Nov 15 '22 08:11

Reed Copsey


Its not like converting vb.net to C# or something, WPF is a totally different way of writing windows apps.

However, if you have your code cleanly abstracted, and/or your UI code separated from logic, you shouldn't have too much trouble porting it to WPF.

WPF also does have the WindowsFormsHost class. Here is a Walkthrough on Hosting a windows forms control in WPF.

like image 42
gideon Avatar answered Nov 15 '22 07:11

gideon