XAML Introduction
I am working on learning how XAML works, a relatively new and evolving format for developing Windows applications. For those of you who have built web pages using HTML, you will see that it is somewhat similar. XAML is a structured language using tagged data. A very basic HTML web page would be structured like this.
<html>
<head>
<title>Hello World</title>
</head>
<body>
Hello World!
</body>
</html>
Let's look at what this text does. the HTML tag (<html>) is the container for the web page. The head tag denotes the part of the page which is not displayed. It includes the page title and content that describes the page, or tells the page how to act. The body tag contains the content that is displayed on the web page, such as the text "Hello World!"
The spacing is not important, but is there for readability purposes. The basics of HTML are that you have an opening tag "<TagName>" and a closing tag "</TagName>" or you can have a single tag that opens and closes itself like "<TagName />".
HTML and XAML are both subsets of a structured highly structured text format called XML. HTML doesn't necessarily require all tags to be closed. A newer version of HTML called XHTML does require all tags to be closed, and thus is a true subset of XML.
So now that you have a very basic understanding of HTML, lets look at some XAML. By the way, you will need to either be running Microsoft Windows Vista and / or Internet Explorer 7 or have Microsoft WinFX (now called .Net 3.0) installed on Windows XP.
<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<TextBlock>
Hello World!
</TextBlock>
</Canvas>
So now let's look at what the XAML instructions do. Their are several possible container tags depending on how the page should be layed out. In this example I am using the Canvas tag as the container. The TextBlock contains the text I want to display, "Hello World!"
So as the title says, this is an introduction to XAML. I will try to get more in depth as time allows, historically it hasn't allowed much. As I said in the opening, I am not expert, but am just learning this, so my examples aren't necessarily the best way to build XAML pages or applications. But hopefully as I learn more my examples will follow the recommended practices.

0 Comments:
Post a Comment
<< Home