Summary: First steps in XAML
SeeAlso: XAMLManifesto
XAML
*Stands for:
- eXtensible Application Markup Language
*Pronounced
- "Zammel"
First XAML
Requirements *Longhorn: Yes
*Longhorn SDK: No
*Visual Studio 2005: No
<Canvas ID="root"
xmlns="http://schemas.microsoft.com/2005/xaml">
<Button ID="Button001">Button001 Text</Button>
</Canvas>
This does not have any event handling code. This means you can just paste it into notepad and save it as a .XAML file, if you are running Longhorn, and you will have your first XAML Interface. -- HE3
Second XAML
Requirements *Longhorn: Yes
*Longhorn SDK: Yes
*Visual Studio 2005: No
<Canvas ID="root"
xmlns="http://schemas.microsoft.com/2005/xaml"
xmlns:def="Definition">
<Button ID="Button001" Click="OnClick">Button001 Text</Button>
<def:Code>
<![CDATA[
void [OnClick(object] sender, [ClickEventArgs] args)
{
Button001.Content = "Button001 Clicked";
}
]]>
</def:Code>
</Canvas>
This is an example of an XAML file with some event handling code. Another option would be to have a seperate code-behind file which I will be exploring later. Because this XAML file has code it must be compiled. I used XamlC.exe which was installed with the Longhorn SDK. -- HE3
Notes
Q. Why can't Longhorn compile it when I double click the .XAML file?
A. http://longhornblogs.com/rrelyea/archive/2004/04/08/3030.aspx
I posted a bit of an explanation of the compilation model here: http://www.longhornblogs.com/rrelyea/archive/2004/04/08/3030.aspx -- Rob Relyea