Why you should develop systems in WPF, not WinForms
Part five of a -part series of blogs

Posted by Andy Brown on 25 September 2012

You need a minimum screen resolution of about 700 pixels width to see our blogs. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.

4 - Styles are Much Better in WPF

Perhaps I should have put this as reason number one.  Suppose that you want all buttons to appear the same:

Two buttons with styles applied

Both buttons have the same margins, padding and background colour.


I can't think of an easy way to achieve this in WinForms.  In WPF, you'd just create a style:

Styles for buttons

The styles for the buttons shown above.

Although style syntax is very different from CSS, WPF styles work the same way.  You can even create something called resource dictionaries (similar to CSS style sheets) allowing you to change the appearance of forms instantly.

You can also create named styles in WPF (so some buttons could look different from others), and inherited styles (so a button could look similar to all others, but with one additional tweak).

This blog has 0 threads Add post