This article is currently in the process of being translated into isiXhosa (~42% done).
WPF vs. WinForms
Kwi-chapter edlulileyo, sithethe nge-WPF sangena nakancinci kwi-WinForms. Kule-chapter,ndizozama ukuthelekisa ezi zinto zombini, nangona zisenza umsebenzi omnye, mninzi umohluko phakathi kwazo. Ukuba awuzange wayisebenzisa i-WinForms ngaphambili, ikakhulu ukuba i-WPF yiGUI framework yakho yokuqala, ungadlula kule-chapter,kodwa uba unomdla wokwazi umohluko qhubekeka ufunde.
Umohluko omnye obalulekileyo phakathi kwe-WinForms ne-WPF kukuba i-WinForms yi-layer ephezu kwe standard Windows controls (umzekelo i-TextBox), i-WPF yakhiwe yaye ayixhomekekanga kwi-standard Windows controls kuzo zonke izimo. Ingakhangeleka ingumohluko omncinci lo, kodwa awukho mncinci, uzakuwubona ukuba wakhe wasebenzisa i-framework exhomekeke kwi Win32/WinAPI.
Umzekelo ocacileyo yi-button enomfanekiso namagama kuyo. Ayiso standard Windows control, iWinForms ukawazi uyenza. Kufuneka uzobe umfanekiso ngokwakho, wenze nebutton ekwaziyo ukusebenzisana nemifanekiso okanye usebenzise i-3rd party control. Kwi-WPF i-button inganayo nantoni na kuba iyi-border ene-content nezitates (states) ezininzi (umzekelo untouched,hovered,pressed). i-WPF button ayibonakali, njengezinye i-WPF controls, loo nto ithetha ukuba iyakwazi ubanayo nantoni na kuyo. Ufuna i-button enomfanekiso nombhalo ? Faka umfanekiso ne-TextBlock phakathi kwebutton ube ugqibile ngokwenza njalo! Awukwazi uyenza loo nto kwi-WinForms controls, ngunobangela wokuba kubene-market enkulu yokwenza i-controls ezifana nebuttons ezinemifanekiso njalo njalo.
I-drawback yale flexibility kukuba ngamanye amaxesha kufuneka usebenze nzima uku-achiever into elula ku WinForms, kuba yenziwe for i-scenario oyidingela yona. Ikhangeleka njalo ekuqaleni,uzifumanisa usenza i-templates ukwenza iListView nomfanekiso nombhalo o-aligned kakuhle, yinto eyenza ngomqolo omnye we-code i-WinForms ListViewItem.
This was just one difference, but as you work with WPF, you will realize that it is in fact the underlying reason for many of the other differences - WPF is simply just doing things in its own way, for better and for worse. You're no longer constrained to doing things the Windows way, but to get this kind of flexibility, you pay with a little more work when you're really just looking to do things the Windows way.
The following is a completely subjective list of the key advantages for WPF and WinForms. It should give you a better idea of what you're going into.
WPF advantages
- It's newer and thereby more in tune with current standards
- u-Microsoft usebenzisa ii-applications ezintsha ezininzi umzekelo u-Visual Studio.
- It's more flexible, so you can do more things without having to write or buy new controls
- When you do need to use 3rd party controls, the developers of these controls will likely be more focused on WPF because it's newer
- XAML makes it easy to create and edit your GUI, and allows the work to be split between a designer (XAML) and a programmer (C#, VB.NET etc.)
- Databinding, which allows you to get a more clean separation of data and layout
- Uses hardware acceleration for drawing the GUI, for better performance
- It allows you to make user interfaces for both Windows applications and web applications (Silverlight/XBAP)
WinForms advantages
- It's older and thereby more tried and tested
- There are already a lot of 3rd party controls that you can buy or get for free
- The designer in Visual Studio is still, as of writing, better for WinForms than for WPF, where you will have to do more of the work yourself with WPF
- Afar
- Afrikaans
- Albanian
- Arabic
- Bulgarian
- Catalan
- Chinese
- Croatian
- Czech
- Danish
- Dutch
- Finnish
- French
- German
- Gujarati
- Hebrew
- Hindi
- Hungarian
- Indonesian
- Italian
- Japanese
- Kannada
- Korean
- Lithuanian
- Macedonian
- Norwegian Bokmål
- Persian
- Polish
- Portuguese
- Romanian
- Russian
- Serbian
- Slovak
- Slovenian
- Spanish
- Swedish
- Tamil
- Thai
- Turkish
- Ukrainian
- Uzbek
- Vietnamese