Your mind reaching for new heights once you realize how easy it is to make new styles (it is a picture of a SpaceX rocket taking off)

Styling WPF applications is easy! [Part 0 — An Introduction]

Joshua Miller
4 min readOct 10, 2017

--

After teaching a few people how easy it is to create new styles for WPF applications, I decided it would be a better use of my time (and theirs) if I wrote everything down in a tutorial format. This first article, and the ones that are bound to follow, are the result of that decision.

Before reading

By the fact that you found this article, I am hoping that you have had some prior exposure to WPF. As such, I will not be diving into the details of different components. Do not let that scare you off though! The articles that come after this should go into enough detail for anyone of any level to follow along. If you do run into any issues, just let me know.

The Backstory

I have had the opportunity to witness and experience many unique things over the past year and a half of developing WPF applications. Some were awesome, and some would make most people run for the hills screaming, “WPF application development is terrible and always will be!”

One recurring experience/problem I have had is trying to get developers to match WPF control styles to company standards. For most companies, I expect that this is a pretty standard process. I have seen solutions across the web that make consistently styling websites and mobile apps a piece of cake. However, I haven’t seen much for WPF.

There is one item of note that I do see in relation to WPF though, and that is: developers seem to be the ones writing most of the styles. To be clear, by writing I mean writing the xaml that is the control styles and templates that get consumed by the application, not the company design standards. When I ask my coworkers and fellow conference goers (the ones who do WPF development, at least) why they think that is, I typically get the answer, “because writing styles, i.e. writing code, requires a programming background.” This is a perfectly reasonable response if you assume that writing styles can only be done when you write them by hand. If you are coming from the WinForms world, you definitely would need a programming background to write new styles! But this article is about WPF, and in WPF you do not need to write them by hand. You can easily create styles and control templates using a designer (Microsoft Blend, to be precise).

Who will these articles be for?

These articles are for anyone who wants to learn how easy it is to change the appearance of controls in a WPF application!

Important note: I will not be showing, touching, or writing any code whatsoever. I will be creating these styles solely through the designer in Microsoft Blend (in the future, I will just say Blend).

What is the goal of these articles?

The goal is to demonstrate how easy it is to create control styles!

To be more direct: I hope to show that designers are not limited to solely using a combination of Photoshop and/or whatever control design library seems to be popular on the internet at the moment to communicate style requirements. In fact, I want to show that designers can contribute to the actual code base by writing real, usable styles! Now, if having designers contribute to a code base is not possible in your situation, I hope to at least provide some basic knowledge around style creation that will allow for clearer communication between the folks who do design and the folks who do development.

What is the problem with developers writing styles?

To be fair, developers writing styles is not actually a problem. The real problem is when developers write styles without clearly understanding the company design guidelines that they most likely have had no hand in creating. If the designers write the styles themselves, the chances for making mistakes are greatly reduced. Again, even if it is infeasible to have the designers write the styles themselves, having knowledge around how styles are created and what goes into creating a good style will allow them to better communicate the company standards to those who are writing the styles for a WPF application.

Articles that may follow this one

  1. Preparation and a quick introduction to Blend
  2. Creating your first button style from scratch!
  3. Making your first button style pretty
  4. Using Visual States to make responsive controls
  5. Creating a button style based off of the current template
  6. Types of styles and when to create them
  7. Common questions

--

--

Joshua Miller

Just a guy trying to share some knowledge about various topics that he finds interesting.