[ACCEPTED]-What is the difference between WPF and WinForms?-winforms
One obvious answer is that WPF offers a 11 richer user experience than WinForms, allowing 10 for animations (even 3D) in the user interface, for 9 example.
From a development perspective, it 8 goes a long way to enforce the separation 7 of the User Interface (in the XAML) from 6 the business logic (in VB.NET or C#), which 5 is always a good thing.
A Google search for 4 "WPF vs WinForms" brings up lots 3 of pages that discuss this issue. I won't 2 repeat all their findings here, but this page raises 1 some interesting points:
- Databinding in WPF is superior to what Windows Forms offers.
- UI and C# business logic can be cleanly separated in WPF
- Storyboard
- Data/control templates – a much cleaner way than anything Windows Forms can offer.
- Styles – cool and simple. Its so easy to style all your buttons in an application to have the same look and feel.
- Even if the VS designer breaks, its easy to code XAML.
- UI virtualization – I’ve got grids with 100K rows, ticking off a moving market. Performance would be dreadful if it wasn’t for UI visualization which come for free.
- 3D support.
- Nothing scientific but, UI development feels quicker in WPF – maybe its just because a WPF application looks cooler at the end of an iteration, or maybe its because development really is quicker.
- I can add a User Experience engineer to my team, and with no C# knowledge he can work magic in Expression Blend and give the front-office trading application a makeover that is guaranteed to win over the business users.
WPF is the current platform for developing 26 Windows desktop applications. It is a modern, advanced, hardware 25 accelerated framework for developing applications 24 that maintain separation of concerns. It 23 supports advanced rendering of 2D vector 22 and 3D graphics, providing an immense range 21 of capabilities for building rich, interactive, and 20 quality user interfaces.
WinForms, on the 19 other hand, provides a basic platform for 18 developing "classic" Windows apps 17 with your standard look and feel using standard 16 controls. It does not offer the rich, hardware 15 accelerated, vector 2D and 3D capabilities 14 that WPF offers. WinForms applications tend 13 to have much greater coupling between application 12 behavior and UI (view), which presents a 11 less flexible platform upon which to develop 10 applications.
As for which one you choose, it 9 entirely depends on your needs. If you need 8 vector graphics, 3D rendering, the ability 7 to create rich, interactive, animated, modern 6 user interfaces, and/or wish to maintain 5 separation of concerns, WPF is definitely 4 the right choice. If you need none of that, and 3 just need to create a simple UI that solves 2 a simple problem, WinForms will meet your 1 needs just fine.
- To learn.
- To have greater (i.e. any) control over the appearance of your program
- To benefit from easier data binding, triggers, styles
(I don't see what DB support has got to 1 do with it)
WPF can utilize hardware acceleration to 13 some degree, but that is expected to improve 12 over time.
Also, because of XAML, you have 11 more options for "doing stuff", declarative 10 vs. programmatic, or a mixture of both.
Microsoft 9 no longer does active development on WinForms, they 8 are strongly pushing WPF, and for good reason.
WPF 7 allows for much easier "resolution 6 agnostic" designing. To achieve that 5 in WinForms, it is a lot more work.
The MVVM 4 pattern was already mentioned in one of 3 the comments, this allows one to do real 2 unit testing vs. GUI-based testing on your 1 code, that is a big win, in my experience.
Nobody mentioned about better testing capabilities 3 of the WPF applications (if they are written 2 in the correct way, for example based on 1 the MVVM pattern).
A
Anywhere Execution due to XAML.
Can be 35 used as WinApp, WebApp, Mobile.
Whereas WindowsForm 34 Internal UI representation is in C#.
B
Binding 33 -->Simple object to object data transfer.
C
Common 32 look and feel(Styles) -->can define look 31 and feel styles commonly and use it for 30 bunch of controls.
D
Directive Programming 29 -->Binding objects in XAML.
E
Expression blend 28 and Animation-->WPF uses DirectX, and DirectX 27 can be used for animation.
F
Faster Execution(Hardware 26 Rendering)
WPF internally uses DirectX (Hardware 25 rendering) while Winform internally uses 24 GDI (mostly uses Software rendering).
There 23 are two ways by which a computer renders 22 display on monitor.
1) (CPU) Software rendering 21 -->In case of CPU rendering ,the CPU drives 20 the whole logic of rendering display on 19 monitor.CPU also does other operations like 18 running applications,performing memory management,running 17 OS. So on top of it its extra load to display 16 things on monitor.
2)(GPU) Hardware rendering 15 -->Its Specialized kinda processor, specifically 14 meant for rendering and display faster on 13 monitor.
Now in WPF, this rendering is further 12 optimised in
>Tier 0 mode (Software rendering) uses DirectX7 internally,
>Tier 1 mode (Partial Hardware rendering) uses DirectX7 to DirectX9 internally,
>Tier 2 mode (Hardware rendering) uses DirectX9 internally.
G
Graphic Independence (DIP) -->Means 11 resolution independence
Resolution --> Total 10 number of pixels that fits into screen/monitor
Pixel 9 --> Simple dot on screen.
Windows form uses 8 pixels as a measurement unit, so when pixel 7 changes then win forms has to adjust itself 6 that means we have to write logic for it.
But 5 WPF does not use pixels as a measurement 4 unit but uses DIP(Device independent pixels)
1 3 DIP = 1/96th of the inch.
At last Testing 2 --> Better unit testing with use of MVVM 1 pattern.
If you want to have a rich user interface 6 like the image posted in your previous question, I'd recommend 5 going with WPF. Aside from making it easier 4 to create a nice-looking application, it's 3 also the technology Microsoft will push 2 in the future. There's almost no new development 1 for Winforms.
The single most important difference between 16 WinForms and WPF is the fact that while 15 WinForms is simply a layer on top of the 14 standard Windows controls (e.g. a TextBox), WPF 13 is built from scratch and doesn't rely on 12 standard Windows controls in almost all 11 situations.
A great example of this is a 10 button with an image and text on it. This 9 is not a standard Windows control, so WinForms 8 doesn't offer you this possibility out of 7 the box. Instead, you will have to draw 6 the image yourself, implement your own button 5 that supports images or use a 3rd party 4 control. With WPF, a button can contain 3 anything because it's essentially a border 2 with content and various states (e.g. untouched, hovered, pressed).
check 1 this article it will help you: https://www.wpf-tutorial.com/about-wpf/wpf-vs-winforms/#:~:text=The%20single%20most%20important%20difference,controls%20in%20almost%20all%20situations.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.