I’ve seen people writing code rather in the XAML page than in the C# code page. Things seem to be easier, faster.
So I figured, it might be time to take a closer look.
XAML (Extensible Application Markup Language) is a declarative XML-based language created by Microsoft which is used to initialize structured values and objects.
When creating a new project (or opening an existing one) the first thing I see in Visual Studio is the design pane on the left side and the XAML pane on the right side. The design pane provides a fast and convenient way to arrange controls and set properties visually. Everything that goes on in the design pane has one purpose. And that is to create code in the XAML window. The XAML is what actually gets compiled into a .NET assembly, a .dll file that ultimately gets packaged up in a SAP file.
To have an example I just created a new project. When I drag a button control to my design surface, something happens in the XAML pane. Some code is being generated that defines the button:
That’s a whole block of code without me even having to write it. Now I want to create a new button without dragging it to my design pane. I am writing code in XAML:
What happens now, is that this in XAML created button also appears in my design pane:
The first button was dragged and dropped, the second one was created in XAML.
Since I don´t have a click event for my buttons, the C# code for my buttons just refers to my XAML pane:
Basically what I learned is that if I really want to develop applications for Windows Phone 7, I have to continue learning C#, but also XAML. Well, so far that doesn’t seem too difficult.
To be continued…