In the last tutorial, we learnt how to create a simple WPF application using visual studio, how to add controls to the XAML and how to set properties to them (remember height and width of button?). The properties we set in the tutorial were, however, of simple value type. Not all properties are of simple value types. Some properties are made up of multiple objects, which might themselves have multiple properties, which might again have objects…you get the idea! These are complex type properties and setting them is slightly more complex too.
Let us consider the case of “Background” property on the Button control.
You should now have a basic understanding of what WPF is and when and why you should use it. Now come the components of WPF. The first thing you should understand, when developing WPF applications is XAML. XAML is the core of WPF applications (also of silverlight, but more of that later).
XAML stands for Extensible Application Markup Language. You pronounce it as “zamel”. It is an XML based language used for creating user interfaces in WPF + for serializing .NET object instances into a human readable format. It is also used by the workflow foundation for defining workflows but that is beyond the scope of this tutorial. The main advantage that XAML provides is declarative UI. You can create UI elements in the xaml, and then separate the visual aspect from logic by putting the logic in code-behind files (xaml.cs), joined to xaml through partial class definitions.
This post is first among a series of tutorial posts that will teach WPF to beginners. The entire series will be divided into around 20-25 posts and each one should take you around 1/2 to 1 hour maximum to read and understand. If you follow them in the order that they have been written (from bottom to top), the series will not take more than a few days to complete. However, it is expected that you will have some basic background of .Net development and understanding of .Net framework before you begin these. If not, look forward to our next tutorial series on .Net development. All the code in these tutorials are written using Visual Studio 2012, and for database, we are going to use MS SQL 2008 R2. The code will work even on older versions of Visual Studio (those that support WPF) but you may have to change some things manually, and since it is not possible to list all the changes, we recommend using 2012 for a seamless learning experience. The express edition is free for trial.