So far, in this series of tutorials , we work in C # windows. In our last post we talked about the Object Collection. From this tutorial, we will spend more and more time in the XAML window instead of the C # window. So far I’ve seen XAML windows, but I haven’t interacted with them other than dragging and dropping commands into the visual editor. Now we will start using the XAML editor more aggressively as we build our application.
As we saw earlier, when we open any project in Silverlight, we have two panels in front of us. One panel is the visual editor and another with XAML code. So let’s start by understanding how it works. XAML is a programming language just as C # is another programming language. XAML is used mainly to design the user interface .
When we pull any controls in the visual editor, you may have noticed that when we do this, a certain code is automatically added to the XAML window. Similarly, when we make changes to any property of the controls, the XAML code changes as well. This is done automatically by Visual Studio for our convenience and therefore we have a very easy and simple «Drag and Drop» interface.
Now look at the top of the XAML windows, you will see a few lines starting with " src = »https://pchardwarepro-pchardwareproco.netdna-ssl.com/wp-content/uploads/2012/03/Snip2-e1331530338953.png»>
There are various layout controls, which help users to place their commands according to their wishes on the screen. Some of them are panels, grids, etc.
We will create a button using the XAML code. Create a new project with a meaningful name. Search for the following code:
Grid x: Name ="ContentPanel" Grid.Row ="1" Marja ="12,0,12,0"> i>; SPREAD THE WORD-
And paste the following code between these grid tags:
After pasting this code, notice that a new button will be created on the surface of the designer. Congratulations, you just created a button using only pure encoding.
There is a lot to learn in the XAML window, but keep studying it until we return to the next tutorial. In the next tutorial, we will learn about all the Silverlight design commands.