Why you shouldn’t use a GUI designer in WPF and Silverlight

by Geert 24. February 2011 11:26

For some years, I am trying to convince people in my surroundings not to use the GUI designer for WPF and Silverlight. Some with success, some without. In my crusade to perfect software development for all users (not just you), I finally found some time and energy to create an example application and a video that shows why you shouldn’t be using the GUI designer to design GUI’s.

First of all, I don’t say (or want to) that you shouldn’t be using the designer at all. I just want to tell you that you will have to be very careful and think what you are doing in the designer. Some people use the argument that they need to know all this “xaml” out of their head, that’s why they use the GUI designer. However, isn’t xaml one of the most important things of WPF or Silverlight? And wouldn’t it be cool to be actually good at what you’re doing? Yes, of course! So, then learn it. The designer can still be of use at first to check whether your written xaml is interpreted the way you meant it.

I don’t believe you, show me it first

An example is a good way to start, so let’s show a screenshot of the application that is attached to this blog post. It shows 2 (actually 3, but let’s ignore the main window for now) windows, one created without the GUI designer (left) and one created with the GUI designer (right):

image

For now, both look fine (you can see all controls, text inside the controls looks fine, etc). However, when we change the theme to “Aero - large” (just increases the margins for all controls, same what 120 DPI does), you see that the manually designed window (left) adjusts fine. However, the right one has fixed margins (thanks to the designer), and thus sticks to that. However, you see that the controls are even closer together, and the text inside the TextBox is not readable any longer.

image

To convince you, I have also included a video that shows what actually happens at runtime:

 

 

 

Detailed explanation

There are several reasons why I recommend you not to use the GUI designer to design or even view your UI for WPF and Silverlight:

  • You don’t want to exclude users that choose a different DPI
    As you already saw in the screenshots and video above, when the user changes to a different DPI or theme (with different margins and sizes), your users will not be able to use your applications any longer (they can’t read their input to validate). 

  • It’s instable and slow (at least in VS2008)
    The last time I used the GUI designer (except to create this article) was back at the days of Visual Studio 2008. It was extremely instable. As soon as the designer began to load, Visual Studio crashed immediately. Great if you have some code changes opened. During that time, I created my tick to press CTRL + SHIFT + S every 10 keystrokes. Also, I am not sure if you have every written complex or large UI items, but I can write lots of code in xaml during the time that the designer needs to initialize.

NoGUIDesigner.zip (1.65 mb) [Downloads: 348]

Tags:

Silverlight | WPF

Comments (1) -

Michael
Michael Germany
2/25/2011 4:06:01 PM #

Well you should go tell this guy jesseliberty.com/2011/02/22/silverlight-sans-xaml/ (if you haven't already) Wink

Comments are closed

About the Author

Geert van Horrik is an independent freelance software developer since January 1st, 2007. Since then he was been working on several projects from C++ to C# (WPF, Silverlight, ASP.NET, etc). Currently he loves to write his software using WPF (or Silverlight if WPF isn't an option).

Lately, Geert is spending a lot of time on Catel, a free open-source MVVM Framework for WPF and Silverlight. Actually, it's more than "just" an MVVM Framework, it's a complete application library!