Back in 2000 when I first started playing around in the .NET space, one of the things that drew me to the platform was how language concepts in C# and VB.NET meshed so well with the framework – it was a very natural development experience, you could learn a few simple rules and apply them all over the place to help you understand complex things.
As I start working with Windows Presentation Foundation I’m starting to realise that there is another set of rules that to learn, and that if I can I’ll be able to delivery extremely sophisticated user interfaces without too much difficulty.
If we take XAML as an example, I can see that there are a few fundamentals that developers must get across before they can be truly proficient, what follows is a (very) short list of what I think is important to understand.
- XAML is just an object graph represented in XML.
- When you get a runtime exception, always look at the InnerException.
- It is important to understand PropertyPath syntax.
In addition to these starting points, a useful way to approach learning XAML is to follow these steps on a continual basis.
- First, get it working on a single UI element.
- Second, get it working on multiple UI elements using styles.
- Third, get it working on multiple UI elements using DataTemplates.
While in general it is fairly straight-forward moving between each of these approaches, there are some gotchas – and you learn a lot of tricks in the process.