MIME-Version: 1.0
Content-Type: multipart/related; boundary="----=_NextPart_01C6DD70.F0A21EB0"

This document is a Single File Web Page, also known as a Web Archive file.  If you are seeing this message, your browser or editor doesn't support Web Archive files.  Please download a browser that supports Web Archive, such as Microsoft Internet Explorer.

------=_NextPart_01C6DD70.F0A21EB0
Content-Location: file:///C:/CA4B30D3/XamlApplicationBasics.htm
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset="us-ascii"

<html xmlns:o=3D"urn:schemas-microsoft-com:office:office"
xmlns:w=3D"urn:schemas-microsoft-com:office:word"
xmlns:st1=3D"urn:schemas-microsoft-com:office:smarttags"
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=3DContent-Type content=3D"text/html; charset=3Dus-ascii">
<meta name=3DProgId content=3DWord.Document>
<meta name=3DGenerator content=3D"Microsoft Word 11">
<meta name=3DOriginator content=3D"Microsoft Word 11">
<link rel=3DFile-List href=3D"XamlApplicationBasics_files/filelist.xml">
<title>XAML Basics &#8211; how XAML becomes an Application</title>
<o:SmartTagType namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags"
 name=3D"place"/>
<!--[if gte mso 9]><xml>
 <o:DocumentProperties>
  <o:Author>jfosler</o:Author>
  <o:LastAuthor>jfosler</o:LastAuthor>
  <o:Revision>2</o:Revision>
  <o:TotalTime>20</o:TotalTime>
  <o:Created>2006-09-21T18:27:00Z</o:Created>
  <o:LastSaved>2006-09-21T18:27:00Z</o:LastSaved>
  <o:Pages>1</o:Pages>
  <o:Words>1338</o:Words>
  <o:Characters>7630</o:Characters>
  <o:Company>Microsoft Corporation</o:Company>
  <o:Lines>63</o:Lines>
  <o:Paragraphs>17</o:Paragraphs>
  <o:CharactersWithSpaces>8951</o:CharactersWithSpaces>
  <o:Version>11.8036</o:Version>
 </o:DocumentProperties>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:PunctuationKerning/>
  <w:ValidateAgainstSchemas/>
  <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
  <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
  <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
  <w:Compatibility>
   <w:BreakWrappedTables/>
   <w:SnapToGridInCell/>
   <w:WrapTextWithPunct/>
   <w:UseAsianBreakRules/>
   <w:DontGrowAutofit/>
   <w:UseFELayout/>
  </w:Compatibility>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
 </w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:LatentStyles DefLockedState=3D"false" LatentStyleCount=3D"156">
 </w:LatentStyles>
</xml><![endif]--><!--[if !mso]><object
 classid=3D"clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=3Dieooui></objec=
t>
<style>
st1\:*{behavior:url(#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:Wingdings;
	panose-1:5 0 0 0 0 0 0 0 0 0;
	mso-font-charset:2;
	mso-generic-font-family:auto;
	mso-font-pitch:variable;
	mso-font-signature:0 268435456 0 0 -2147483648 0;}
@font-face
	{font-family:"MS Mincho";
	panose-1:2 2 6 9 4 2 5 8 3 4;
	mso-font-alt:"\FF2D\FF33 \660E\671D";
	mso-font-charset:128;
	mso-generic-font-family:modern;
	mso-font-pitch:fixed;
	mso-font-signature:-1610612033 1757936891 16 0 131231 0;}
@font-face
	{font-family:PMingLiU;
	panose-1:2 2 3 0 0 0 0 0 0 0;
	mso-font-alt:\65B0\7D30\660E\9AD4;
	mso-font-charset:136;
	mso-generic-font-family:roman;
	mso-font-pitch:variable;
	mso-font-signature:3 137232384 22 0 1048577 0;}
@font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:1627421319 -2147483648 8 0 66047 0;}
@font-face
	{font-family:Verdana;
	panose-1:2 11 6 4 3 5 4 4 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:536871559 0 0 0 415 0;}
@font-face
	{font-family:"\@MS Mincho";
	panose-1:2 2 6 9 4 2 5 8 3 4;
	mso-font-charset:128;
	mso-generic-font-family:modern;
	mso-font-pitch:fixed;
	mso-font-signature:-1610612033 1757936891 16 0 131231 0;}
@font-face
	{font-family:"\@PMingLiU";
	panose-1:2 2 3 0 0 0 0 0 0 0;
	mso-font-charset:136;
	mso-generic-font-family:roman;
	mso-font-pitch:variable;
	mso-font-signature:3 137232384 22 0 1048577 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-update:auto;
	mso-style-parent:"";
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	mso-bidi-font-size:12.0pt;
	font-family:Tahoma;
	mso-fareast-font-family:"MS Mincho";
	mso-bidi-font-family:"Times New Roman";}
h1
	{mso-style-next:Normal;
	margin-top:12.0pt;
	margin-right:0in;
	margin-bottom:3.0pt;
	margin-left:0in;
	mso-pagination:widow-orphan;
	page-break-after:avoid;
	mso-outline-level:1;
	font-size:16.0pt;
	font-family:Arial;
	mso-font-kerning:16.0pt;}
h3
	{mso-style-next:Normal;
	margin-top:12.0pt;
	margin-right:0in;
	margin-bottom:3.0pt;
	margin-left:0in;
	mso-pagination:widow-orphan;
	page-break-after:avoid;
	mso-outline-level:3;
	font-size:13.0pt;
	font-family:Arial;
	mso-fareast-font-family:PMingLiU;
	mso-fareast-language:ZH-TW;}
h4
	{mso-style-next:Normal;
	margin-top:12.0pt;
	margin-right:0in;
	margin-bottom:3.0pt;
	margin-left:0in;
	mso-pagination:widow-orphan;
	page-break-after:avoid;
	mso-outline-level:4;
	font-size:14.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:PMingLiU;
	mso-fareast-language:ZH-TW;}
p.MsoFootnoteText, li.MsoFootnoteText, div.MsoFootnoteText
	{mso-style-noshow:yes;
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:Tahoma;
	mso-fareast-font-family:PMingLiU;
	mso-bidi-font-family:"Times New Roman";
	mso-fareast-language:ZH-TW;}
p.MsoCommentText, li.MsoCommentText, div.MsoCommentText
	{mso-style-noshow:yes;
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:Tahoma;
	mso-fareast-font-family:PMingLiU;
	mso-bidi-font-family:"Times New Roman";
	mso-fareast-language:ZH-TW;}
span.MsoFootnoteReference
	{mso-style-noshow:yes;
	vertical-align:super;}
span.MsoCommentReference
	{mso-style-noshow:yes;
	mso-ansi-font-size:8.0pt;
	mso-bidi-font-size:8.0pt;}
a:link, span.MsoHyperlink
	{mso-ansi-font-size:10.0pt;
	font-family:Verdana;
	mso-ascii-font-family:Verdana;
	mso-hansi-font-family:Verdana;
	color:blue;
	text-decoration:underline;
	text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;
	text-underline:single;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
	{mso-style-noshow:yes;
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:8.0pt;
	font-family:Tahoma;
	mso-fareast-font-family:"MS Mincho";}
p.BulletedList1, li.BulletedList1, div.BulletedList1
	{mso-style-name:BulletedList1;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:0in;
	margin-left:.75in;
	margin-bottom:.0001pt;
	text-indent:-.25in;
	mso-pagination:widow-orphan;
	mso-list:l1 level1 lfo1;
	tab-stops:list .75in;
	font-size:9.0pt;
	mso-bidi-font-size:12.0pt;
	font-family:Verdana;
	mso-fareast-font-family:"Times New Roman";
	mso-bidi-font-family:"Times New Roman";
	mso-fareast-language:EN-US;}
p.BulletedList2, li.BulletedList2, div.BulletedList2
	{mso-style-name:BulletedList2;
	mso-style-parent:BulletedList1;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:0in;
	margin-left:1.25in;
	margin-bottom:.0001pt;
	text-indent:-.25in;
	mso-pagination:widow-orphan;
	mso-list:l1 level2 lfo1;
	tab-stops:list 1.25in;
	font-size:9.0pt;
	mso-bidi-font-size:12.0pt;
	font-family:Verdana;
	mso-fareast-font-family:"Times New Roman";
	mso-bidi-font-family:"Times New Roman";
	mso-fareast-language:EN-US;}
p.BulletedList3, li.BulletedList3, div.BulletedList3
	{mso-style-name:BulletedList3;
	mso-style-parent:BulletedList2;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:0in;
	margin-left:1.75in;
	margin-bottom:.0001pt;
	text-indent:-.25in;
	mso-pagination:widow-orphan;
	mso-list:l1 level3 lfo1;
	tab-stops:list 1.75in;
	font-size:9.0pt;
	mso-bidi-font-size:12.0pt;
	font-family:Verdana;
	mso-fareast-font-family:"Times New Roman";
	mso-bidi-font-family:"Times New Roman";
	mso-fareast-language:EN-US;}
 /* Page Definitions */
 @page
	{mso-footnote-separator:url("XamlApplicationBasics_files/header.htm") fs;
	mso-footnote-continuation-separator:url("XamlApplicationBasics_files/heade=
r.htm") fcs;
	mso-endnote-separator:url("XamlApplicationBasics_files/header.htm") es;
	mso-endnote-continuation-separator:url("XamlApplicationBasics_files/header=
.htm") ecs;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-even-header:url("XamlApplicationBasics_files/header.htm") eh1;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
 /* List Definitions */
 @list l0
	{mso-list-id:188379230;
	mso-list-type:hybrid;
	mso-list-template-ids:727582944 67698689 67698691 67698693 67698689 676986=
91 67698693 67698689 67698691 67698693;}
@list l0:level1
	{mso-level-number-format:bullet;
	mso-level-text:\F0B7;
	mso-level-tab-stop:.5in;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Symbol;}
@list l0:level2
	{mso-level-number-format:bullet;
	mso-level-text:o;
	mso-level-tab-stop:1.0in;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:"Courier New";}
@list l1
	{mso-list-id:1076902786;
	mso-list-type:hybrid;
	mso-list-template-ids:-990856814 474411036 -388337310 -1691194916 67698689=
 67698691 67698693 67698689 67698691 67698693;}
@list l1:level1
	{mso-level-number-format:bullet;
	mso-level-style-link:BulletedList1;
	mso-level-text:\F0B7;
	mso-level-tab-stop:.75in;
	mso-level-number-position:left;
	margin-left:.75in;
	text-indent:-.25in;
	font-family:Symbol;}
@list l1:level2
	{mso-level-number-format:bullet;
	mso-level-style-link:BulletedList2;
	mso-level-text:o;
	mso-level-tab-stop:1.25in;
	mso-level-number-position:left;
	margin-left:1.25in;
	text-indent:-.25in;
	font-family:"Courier New";}
@list l1:level3
	{mso-level-number-format:bullet;
	mso-level-style-link:BulletedList3;
	mso-level-text:\F0A7;
	mso-level-tab-stop:1.75in;
	mso-level-number-position:left;
	margin-left:1.75in;
	text-indent:-.25in;
	font-family:Wingdings;}
ol
	{margin-bottom:0in;}
ul
	{margin-bottom:0in;}
-->
</style>
<!--[if gte mso 10]>
<style>
 /* Style Definitions */
 table.MsoNormalTable
	{mso-style-name:"Table Normal";
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-parent:"";
	mso-padding-alt:0in 5.4pt 0in 5.4pt;
	mso-para-margin:0in;
	mso-para-margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:"Times New Roman";
	mso-ansi-language:#0400;
	mso-fareast-language:#0400;
	mso-bidi-language:#0400;}
</style>
<![endif]-->
</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple style=3D'tab-interval:.5in'>

<div class=3DSection1>

<h1>XAML Application Basics</h1>

<h3><a name=3D"_Toc124876575">Learn XAML</a></h3>

<p class=3DMsoNormal>If you&#8217;ve seen &#8220;Avalon&#8221; demos, then =
you
know that it is often developed with using a specialized form of XML called=
 <a
href=3D"http://windowssdk.msdn.microsoft.com/en-us/library/ms752059.aspx"><=
span
style=3D'font-family:Verdana'>XAML</span></a>.<span
style=3D'mso-spacerun:yes'>&nbsp; </span></p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal>It is possible to write &#8220;Avalon&#8221; to the ba=
re
metal using code (C#, VB, or your favorite CLS-Compliant-Language of choice=
),
however the designers of the Avalon libraries have optimized the
&#8220;feel&#8221; of their APIs for <a
href=3D"http://windowssdk.msdn.microsoft.com/en-us/library/ms752059.aspx"><=
span
style=3D'font-family:Verdana'>XAML</span></a> &#8211; sometimes this is just
shortened to the word &#8220;markup&#8221;.<span
style=3D'mso-spacerun:yes'>&nbsp; </span>Charles Petzold has an interesting
discussion <a href=3D"http://www.charlespetzold.com/blog/0510040416.html"><=
span
style=3D'font-family:Verdana'>here</span></a> about when to use what. </p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<h3><a name=3D"_Toc124876576">Some XAML you gotta know</a></h3>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'><=
o:p>&nbsp;</o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>&=
lt;!--</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:green;mso-fareast-language:EN-US;mso-no-proof:yes'>
Window1.xaml </span><span style=3D'mso-bidi-font-size:10.0pt;font-family:"C=
ourier New";
mso-fareast-font-family:"Times New Roman";color:blue;mso-fareast-language:E=
N-US;
mso-no-proof:yes'>--&gt;</span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";color:blue;
mso-no-proof:yes'>&lt;</span><span style=3D'mso-bidi-font-size:10.0pt;font-=
family:
"Courier New";color:maroon;mso-no-proof:yes'>Window</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";color:blue;
mso-no-proof:yes'> </span><span style=3D'mso-bidi-font-size:10.0pt;font-fam=
ily:
"Courier New";mso-no-proof:yes'><o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";color:blue;
mso-no-proof:yes'><span style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp; </spa=
n></span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:red;mso-fareast-language:EN-US;mso-no-proof:yes'>xm=
lns</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>=
=3D</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'>&quot;<span
style=3D'color:blue'>http://schemas.microsoft.com/winfx/2006/xaml/presentat=
ion</span>&quot;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'><=
span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp; </span></span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:red;mso-fareast-language:EN-US;mso-no-proof:yes'>xm=
lns:x</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>=
=3D</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'>&quot;<span
style=3D'color:blue'>http://schemas.microsoft.com/winfx/2006/xaml</span>&qu=
ot;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'><=
span
style=3D'mso-spacerun:yes'>&nbsp;</span></span><span style=3D'mso-bidi-font=
-size:
10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp; </span></span><span style=3D'mso-bi=
di-font-size:
10.0pt;font-family:"Courier New";color:red;mso-no-proof:yes'>x:Class</span>=
<span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";color:blue;
mso-no-proof:yes'>=3D</span><span style=3D'mso-bidi-font-size:10.0pt;font-f=
amily:
"Courier New";mso-no-proof:yes'>&quot;<span style=3D'color:blue'>WindowsApp=
lication1.Window1</span>&quot;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";color:red;
mso-no-proof:yes'><span style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;
</span>Title</span><span style=3D'mso-bidi-font-size:10.0pt;font-family:"Co=
urier New";
color:blue;mso-no-proof:yes'>=3D</span><span style=3D'mso-bidi-font-size:10=
.0pt;
font-family:"Courier New";mso-no-proof:yes'>&quot;<span style=3D'color:blue=
'>Main
Window</span>&quot;<span style=3D'color:blue'> <o:p></o:p></span></span></p>

<p class=3DMsoNormal><span style=3D'mso-bidi-font-size:10.0pt;font-family:"=
Courier New";
color:blue;mso-no-proof:yes'><span style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&=
nbsp;
</span>&gt;</span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><b
style=3D'mso-bidi-font-weight:normal'>What is xmlns?<o:p></o:p></b></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'>Definition
from <a href=3D"http://www.w3.org/TR/REC-xml-names/"><span style=3D'font-fa=
mily:
Verdana'>W3C</span></a>:</p>

<p class=3DMsoNormal style=3D'margin-left:.5in;mso-layout-grid-align:none;
text-autospace:none'>XML namespaces provide a simple method for qualifying
element and attribute names used in Extensible Markup Language documents by
associating them with namespaces identified by URI references.</p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'>By
bringing in custom xml namespaces, we essentially bring in another set of
&#8220;valid&#8221; XML element types and attribute names. </p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:red;mso-fareast-language:EN-US;mso-no-proof:yes'>xm=
lns</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>=
=3D</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'>&quot;<span
style=3D'color:blue'>http://schemas.microsoft.com/winfx/2006/xaml/presentat=
ion</span>&quot;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'margin-left:.5in;mso-layout-grid-align:none;
text-autospace:none'>This pulls in the XML schema for the Windows Presentat=
ion
Foundation itself.<span style=3D'mso-spacerun:yes'>&nbsp; </span>By setting=
 this
as the default XML namespace, we can just create &lt;Button&gt; without
prepending it with anything silly like &lt;wpf:Button&gt;.</p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:red;mso-fareast-language:EN-US;mso-no-proof:yes'>xm=
lns:x</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>=
=3D</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'>&quot;<span
style=3D'color:blue'>http://schemas.microsoft.com/winfx/2006/xaml</span>&qu=
ot;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'margin-left:.5in;mso-layout-grid-align:none;
text-autospace:none'>This brings in XAML keywords, markup extensions (the f=
unny
stuff you&#8217;ll sometimes see in curly braces).<span
style=3D'mso-spacerun:yes'>&nbsp; </span>Interesting x: stuff includes </p>

<p class=3DMsoNormal style=3D'margin-left:.5in;text-indent:.5in;mso-layout-=
grid-align:
none;text-autospace:none'>&#8220;x:Key&#8221; for setting keys in a resource
dictionary</p>

<p class=3DMsoNormal style=3D'margin-left:.5in;text-indent:.5in;mso-layout-=
grid-align:
none;text-autospace:none'>&#8220;x:Static&#8221; for fetching statics off a=
 CLR
class</p>

<p class=3DMsoNormal style=3D'margin-left:.5in;text-indent:.5in;mso-layout-=
grid-align:
none;text-autospace:none'>&#8220;x:Class&#8221; for associating a codebehin=
d </p>

<p class=3DMsoNormal style=3D'margin-left:.5in;text-indent:.5in;mso-layout-=
grid-align:
none;text-autospace:none'>&#8220;x:Type&#8221; for specifying a type</p>

<p class=3DMsoNormal style=3D'margin-left:.5in;text-indent:.5in;mso-layout-=
grid-align:
none;text-autospace:none'>&#8220;x:Null&#8221; for setting something to nul=
l in
XAML</p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";color:red;
mso-no-proof:yes'>x:Class</span><span style=3D'mso-bidi-font-size:10.0pt;
font-family:"Courier New";color:blue;mso-no-proof:yes'>=3D</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-no-proof:y=
es'>&quot;<span
style=3D'color:blue'>WindowsApplication1.Window1</span>&quot;<o:p></o:p></s=
pan></p>

<p class=3DMsoNormal style=3D'margin-left:.5in;mso-layout-grid-align:none;
text-autospace:none'>This helps the XAML compiler to find the associated
code-behind &#8211; in this case it would look for WindowsApplication1.Wind=
ow1
as its codebehind file.</p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";color:red;
mso-no-proof:yes'><o:p>&nbsp;</o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";color:red;
mso-no-proof:yes'>Title</span><span style=3D'mso-bidi-font-size:10.0pt;
font-family:"Courier New";color:blue;mso-no-proof:yes'>=3D</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-no-proof:y=
es'>&quot;<span
style=3D'color:blue'>Main Window</span>&quot;<span style=3D'color:blue'> <o=
:p></o:p></span></span></p>

<p class=3DMsoNormal style=3D'text-indent:.5in;mso-layout-grid-align:none;
text-autospace:none'>Finally an easy one: this one sets the title for the
window to say &#8220;Main Window&#8221;.</p>

<h4><span style=3D'font-size:10.0pt;mso-bidi-font-size:14.0pt;font-family:T=
ahoma;
mso-bidi-font-family:"Times New Roman"'>Bringing in your own objects to the
XAML party<o:p></o:p></span></h4>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'>It is
possible to create any CLR type within XAML.<span
style=3D'mso-spacerun:yes'>&nbsp; </span>You just need to learn the equival=
ent of
the &#8220;using&#8221; statement in XAML. </p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>&=
lt;!--</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:green;mso-fareast-language:EN-US;mso-no-proof:yes'>
Window1.xaml </span><span style=3D'mso-bidi-font-size:10.0pt;font-family:"C=
ourier New";
mso-fareast-font-family:"Times New Roman";color:blue;mso-fareast-language:E=
N-US;
mso-no-proof:yes'>--&gt;</span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";color:blue;
mso-no-proof:yes'>&lt;</span><span style=3D'mso-bidi-font-size:10.0pt;font-=
family:
"Courier New";color:maroon;mso-no-proof:yes'>Window</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";color:blue;
mso-no-proof:yes'> </span><span style=3D'mso-bidi-font-size:10.0pt;font-fam=
ily:
"Courier New";color:red;mso-no-proof:yes'>x:Class</span><span style=3D'mso-=
bidi-font-size:
10.0pt;font-family:"Courier New";color:blue;mso-no-proof:yes'>=3D</span><sp=
an
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-no-proof:y=
es'>&quot;<span
style=3D'color:blue'>WindowsApplication1.Window1</span>&quot;<o:p></o:p></s=
pan></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";color:blue;
mso-no-proof:yes'><span style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp; </spa=
n></span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:red;mso-fareast-language:EN-US;mso-no-proof:yes'>xm=
lns</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>=
=3D</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'>&quot;<span
style=3D'color:blue'>http://schemas.microsoft.com/winfx/2006/xaml/presentat=
ion</span>&quot;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'><=
span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp; </span></span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:red;mso-fareast-language:EN-US;mso-no-proof:yes'>xm=
lns:x</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>=
=3D</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'>&quot;<span
style=3D'color:blue'>http://schemas.microsoft.com/winfx/2006/xaml</span>&qu=
ot;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><b
style=3D'mso-bidi-font-weight:normal'><span style=3D'mso-bidi-font-size:10.=
0pt;
font-family:"Courier New";color:blue;mso-no-proof:yes'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp; </span></span></b><b
style=3D'mso-bidi-font-weight:normal'><span style=3D'mso-bidi-font-size:10.=
0pt;
font-family:"Courier New";color:red;background:yellow;mso-highlight:yellow;
mso-no-proof:yes'>xmlns:local</span></b><b style=3D'mso-bidi-font-weight:no=
rmal'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";color:blue;
background:yellow;mso-highlight:yellow;mso-no-proof:yes'>=3D</span></b><b
style=3D'mso-bidi-font-weight:normal'><span style=3D'mso-bidi-font-size:10.=
0pt;
font-family:"Courier New";background:yellow;mso-highlight:yellow;mso-no-pro=
of:
yes'>&quot;</span></b><b style=3D'mso-bidi-font-weight:normal'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";color:white;
background:blue;mso-highlight:blue;mso-no-proof:yes'>clr-namespace:WindowsA=
pplication1</span></b><b
style=3D'mso-bidi-font-weight:normal'><span style=3D'mso-bidi-font-size:10.=
0pt;
font-family:"Courier New";background:yellow;mso-highlight:yellow;mso-no-pro=
of:
yes'>&quot;</span></b><b style=3D'mso-bidi-font-weight:normal'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";color:white;
mso-no-proof:yes'><o:p></o:p></span></b></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";color:blue;
mso-no-proof:yes'><span style=3D'mso-spacerun:yes'>&nbsp;</span><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp; </span>&gt;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";color:blue;
mso-no-proof:yes'><span style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp; </spa=
n>&lt;</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";color:maroon;
background:yellow;mso-highlight:yellow;mso-no-proof:yes'>local</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";color:maroon;
mso-no-proof:yes'>:<span style=3D'background:lime;mso-highlight:lime'>MyBut=
ton</span></span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";color:blue;
mso-no-proof:yes'>&gt;</span><span style=3D'mso-bidi-font-size:10.0pt;font-=
family:
"Courier New";mso-no-proof:yes'>Moo<span style=3D'color:blue'>&lt;/</span><=
span
style=3D'color:maroon'>local:MyButton</span><span style=3D'color:blue'>&gt;=
<o:p></o:p></span></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";color:blue;
mso-no-proof:yes'>&lt;/</span><span style=3D'mso-bidi-font-size:10.0pt;
font-family:"Courier New";color:maroon;mso-no-proof:yes'>Window</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";color:blue;
mso-no-proof:yes'>&gt;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";color:blue;
mso-no-proof:yes'><o:p>&nbsp;</o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:green;mso-fareast-language:EN-US;mso-no-proof:yes'>=
//
Window1.xaml.cs</span><span style=3D'mso-bidi-font-size:10.0pt;font-family:=
"Courier New";
color:blue;mso-no-proof:yes'><o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";color:blue;
mso-no-proof:yes'>namespace</span><span style=3D'mso-bidi-font-size:10.0pt;
font-family:"Courier New";mso-no-proof:yes'> <span style=3D'color:white;
background:blue;mso-highlight:blue'>WindowsApplication1</span> {<o:p></o:p>=
</span></p>

<p class=3DMsoNormal style=3D'margin-left:.5in;mso-layout-grid-align:none;
text-autospace:none'><span style=3D'mso-bidi-font-size:10.0pt;font-family:"=
Courier New";
color:blue;mso-no-proof:yes'>public</span><span style=3D'mso-bidi-font-size=
:10.0pt;
font-family:"Courier New";mso-no-proof:yes'> <span style=3D'color:blue'>cla=
ss</span>
<span style=3D'color:teal;background:lime;mso-highlight:lime'>MyButton</spa=
n> :
System.Windows.Controls.<span style=3D'color:teal'>Button</span> {<o:p></o:=
p></span></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><span style=3D'mso-bidi-fon=
t-size:
10.0pt;font-family:"Courier New";mso-no-proof:yes'>}<o:p></o:p></span></p>

<p class=3DMsoNormal><span style=3D'mso-bidi-font-size:10.0pt;font-family:"=
Courier New";
mso-no-proof:yes'>}<o:p></o:p></span></p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal>Note that the use of &#8220;local&#8221; is a matter of
choice &#8211; it&#8217;s what you&#8217;ll use to prefix your elements from
that namespace.<span style=3D'mso-spacerun:yes'>&nbsp; </span>We could have
replaced all the &#8220;local&#8221; strings with &#8220;foo&#8221; or
&#8220;WindowsApplication1&#8221; and it would have worked.</p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal><b style=3D'mso-bidi-font-weight:normal'>Bringing in c=
ustom
objects from another assembly<o:p></o:p></b></p>

<p class=3DMsoNormal>When you bring in an object from another assembly, you=
 have
to specify the particular assembly in the xmlns assignment.<span
style=3D'mso-spacerun:yes'>&nbsp; </span>As usual, you also have to add a
reference to the assembly in your Visual Studio project. </p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-spacerun:yes'>&nbsp;</span><span style=3D'mso-bidi-font-size:1=
0.0pt;
font-family:"Courier New";mso-fareast-font-family:"Times New Roman";color:b=
lue;
mso-fareast-language:EN-US;mso-no-proof:yes'>&lt;!--</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:green;mso-fareast-language:EN-US;mso-no-proof:yes'>
Window1.xaml </span><span style=3D'mso-bidi-font-size:10.0pt;font-family:"C=
ourier New";
mso-fareast-font-family:"Times New Roman";color:blue;mso-fareast-language:E=
N-US;
mso-no-proof:yes'>--&gt;</span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>&=
lt;</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";color:maroon;
mso-no-proof:yes'>Window</span><span style=3D'mso-bidi-font-size:10.0pt;
font-family:"Courier New";color:blue;mso-no-proof:yes'> </span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";color:red;
mso-no-proof:yes'>x:Class</span><span style=3D'mso-bidi-font-size:10.0pt;
font-family:"Courier New";color:blue;mso-no-proof:yes'>=3D</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-no-proof:y=
es'>&quot;<span
style=3D'color:blue'>WindowsApplication1.Window1</span>&quot;<o:p></o:p></s=
pan></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";color:blue;
mso-no-proof:yes'><span style=3D'mso-spacerun:yes'>&nbsp; </span></span><sp=
an
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:red;mso-fareast-language:EN-US;mso-no-proof:yes'>xm=
lns</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>=
=3D</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'>&quot;<span
style=3D'color:blue'>http://schemas.microsoft.com/winfx/2006/xaml/presentat=
ion</span>&quot;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'><=
span
style=3D'mso-spacerun:yes'>&nbsp; </span></span><span style=3D'mso-bidi-fon=
t-size:
10.0pt;font-family:"Courier New";mso-fareast-font-family:"Times New Roman";
color:red;mso-fareast-language:EN-US;mso-no-proof:yes'>xmlns:x</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>=
=3D</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'>&quot;<span
style=3D'color:blue'>http://schemas.microsoft.com/winfx/2006/xaml</span>&qu=
ot;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'><=
span
style=3D'mso-spacerun:yes'>&nbsp; </span></span><span style=3D'mso-bidi-fon=
t-size:
10.0pt;font-family:"Courier New";mso-fareast-font-family:"Times New Roman";
color:red;mso-fareast-language:EN-US;mso-no-proof:yes'>xmlns:sys</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>=
=3D</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'>&quot;<span
style=3D'color:blue'>clr-namespace:System;<span style=3D'background:lime;
mso-highlight:lime'>assembly=3DSystem</span></span>&quot;<o:p></o:p></span>=
</p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'><=
span
style=3D'mso-spacerun:yes'>&nbsp; </span>&gt;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'><=
span
style=3D'mso-spacerun:yes'>&nbsp; </span>&lt;</span><span style=3D'mso-bidi=
-font-size:
10.0pt;font-family:"Courier New";mso-fareast-font-family:"Times New Roman";
color:maroon;mso-fareast-language:EN-US;mso-no-proof:yes'>ListBox</span><sp=
an
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>&=
gt;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'><=
span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp; </span>&lt;</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:maroon;mso-fareast-language:EN-US;mso-no-proof:yes'=
>sys:String</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>&=
gt;</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'>One<span
style=3D'color:blue'>&lt;/</span><span style=3D'color:maroon'>sys:String</s=
pan><span
style=3D'color:blue'>&gt;<o:p></o:p></span></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'><=
span
style=3D'mso-spacerun:yes'>&nbsp; </span>&lt;/</span><span style=3D'mso-bid=
i-font-size:
10.0pt;font-family:"Courier New";mso-fareast-font-family:"Times New Roman";
color:maroon;mso-fareast-language:EN-US;mso-no-proof:yes'>ListBox</span><sp=
an
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>&=
gt;<o:p></o:p></span></p>

<p class=3DMsoNormal><span style=3D'mso-bidi-font-size:10.0pt;font-family:"=
Courier New";
mso-fareast-font-family:"Times New Roman";color:blue;mso-fareast-language:E=
N-US;
mso-no-proof:yes'>&lt;/</span><span style=3D'mso-bidi-font-size:10.0pt;
font-family:"Courier New";mso-fareast-font-family:"Times New Roman";color:m=
aroon;
mso-fareast-language:EN-US;mso-no-proof:yes'>Window</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>&=
gt;</span></p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal><b style=3D'mso-bidi-font-weight:normal'>Talking to El=
ements
Defined in XAML From Code<o:p></o:p></b></p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal>If you name your elements in your XAML file, you can a=
ccess
them as if they were member variables on the class.</p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>&=
lt;!--</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:green;mso-fareast-language:EN-US;mso-no-proof:yes'>
Window1.xaml </span><span style=3D'mso-bidi-font-size:10.0pt;font-family:"C=
ourier New";
mso-fareast-font-family:"Times New Roman";color:blue;mso-fareast-language:E=
N-US;
mso-no-proof:yes'>--&gt;</span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>&=
lt;</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:maroon;mso-fareast-language:EN-US;mso-no-proof:yes'=
>Window</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'> =
</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:red;mso-fareast-language:EN-US;mso-no-proof:yes'>x:=
Class</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>=
=3D</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'>&quot;<span
style=3D'color:blue'>WindowsApplication14.Window1</span>&quot;<o:p></o:p></=
span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";color:blue;
mso-no-proof:yes'><span style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp; </spa=
n></span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:red;mso-fareast-language:EN-US;mso-no-proof:yes'>xm=
lns</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>=
=3D</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'>&quot;<span
style=3D'color:blue'>http://schemas.microsoft.com/winfx/2006/xaml/presentat=
ion</span>&quot;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'><=
span
style=3D'mso-spacerun:yes'>&nbsp;</span><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp; </span></span><span style=3D'mso-bi=
di-font-size:
10.0pt;font-family:"Courier New";mso-fareast-font-family:"Times New Roman";
color:red;mso-fareast-language:EN-US;mso-no-proof:yes'>xmlns:x</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>=
=3D</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'>&quot;<span
style=3D'color:blue'>http://schemas.microsoft.com/winfx/2006/xaml</span>&qu=
ot;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'><=
span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp; </span></span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:red;mso-fareast-language:EN-US;mso-no-proof:yes'>Ti=
tle</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>=
=3D</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'>&quot;<span
style=3D'color:blue'>WindowsApplication14</span>&quot;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'><=
span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp; </span>&gt;<o:p></o:p></span>=
</p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'><=
span
style=3D'mso-spacerun:yes'>&nbsp; </span>&lt;</span><span style=3D'mso-bidi=
-font-size:
10.0pt;font-family:"Courier New";mso-fareast-font-family:"Times New Roman";
color:maroon;mso-fareast-language:EN-US;mso-no-proof:yes'>Canvas</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>&=
gt;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'><=
span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp; </span>&lt;</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:maroon;mso-fareast-language:EN-US;mso-no-proof:yes'=
>TextBox</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'> =
</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:red;mso-fareast-language:EN-US;mso-no-proof:yes'>Na=
me</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>=
=3D</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'>&quot;<span
style=3D'color:blue'>textBox1</span>&quot;<span style=3D'color:blue'>&gt;&l=
t;/</span><span
style=3D'color:maroon'>TextBox</span><span style=3D'color:blue'>&gt;<o:p></=
o:p></span></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'><=
span
style=3D'mso-spacerun:yes'>&nbsp; </span>&lt;/</span><span style=3D'mso-bid=
i-font-size:
10.0pt;font-family:"Courier New";mso-fareast-font-family:"Times New Roman";
color:maroon;mso-fareast-language:EN-US;mso-no-proof:yes'>Canvas</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>&=
gt;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>&=
lt;/</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:maroon;mso-fareast-language:EN-US;mso-no-proof:yes'=
>Window</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>&=
gt;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'><o:p>&nbsp;<=
/o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'>From code:</p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:green;mso-fareast-language:EN-US;mso-no-proof:yes'>=
<span
style=3D'mso-spacerun:yes'>&nbsp; </span>// Window1.xaml.cs</span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'><span
style=3D'mso-spacerun:yes'>&nbsp; </span>textBox1.Text =3D <span style=3D'c=
olor:maroon'>&quot;Hello
World!&quot;</span>;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'><o:p>&nbsp;<=
/o:p></span></p>

<p class=3DMsoNormal><span style=3D'color:red'><o:p>&nbsp;</o:p></span></p>

<p class=3DMsoNormal>You can either write this code in the constructor, or =
you
can use the &#8220;Loaded&#8221; event instead.</p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal><u>Option 1: Hooking onto the Loaded event from XAML<o=
:p></o:p></u></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'><=
o:p>&nbsp;</o:p></span></p>

<p class=3DMsoNormal style=3D'text-indent:.5in;mso-layout-grid-align:none;
text-autospace:none'><span style=3D'mso-bidi-font-size:10.0pt;font-family:"=
Courier New";
mso-fareast-font-family:"Times New Roman";color:blue;mso-fareast-language:E=
N-US;
mso-no-proof:yes'>&lt;!--</span><span style=3D'mso-bidi-font-size:10.0pt;
font-family:"Courier New";mso-fareast-font-family:"Times New Roman";color:g=
reen;
mso-fareast-language:EN-US;mso-no-proof:yes'> Window1.xaml </span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>-=
-&gt;</span></p>

<p class=3DMsoNormal style=3D'margin-left:.5in;mso-layout-grid-align:none;
text-autospace:none'><span style=3D'mso-bidi-font-size:10.0pt;font-family:"=
Courier New";
mso-fareast-font-family:"Times New Roman";color:blue;mso-fareast-language:E=
N-US;
mso-no-proof:yes'>&lt;</span><span style=3D'mso-bidi-font-size:10.0pt;font-=
family:
"Courier New";mso-fareast-font-family:"Times New Roman";color:maroon;
mso-fareast-language:EN-US;mso-no-proof:yes'>Window</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'> =
</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:red;mso-fareast-language:EN-US;mso-no-proof:yes'>x:=
Class</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>=
=3D</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'>&quot;<span
style=3D'color:blue'>WindowsApplication14.Window1</span>&quot;<o:p></o:p></=
span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:red;mso-fareast-language:EN-US;mso-no-proof:yes'><s=
pan
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp; </span><span
style=3D'mso-tab-count:1'> </span>xmlns</span><span style=3D'mso-bidi-font-=
size:
10.0pt;font-family:"Courier New";mso-fareast-font-family:"Times New Roman";
color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>=3D</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'>&quot;<span
style=3D'color:blue'>http://schemas.microsoft.com/winfx/2006/xaml/presentat=
ion</span>&quot;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'><=
span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp; </span><span style=3D'mso-tab=
-count:
1'>&nbsp; </span></span><span style=3D'mso-bidi-font-size:10.0pt;font-famil=
y:
"Courier New";mso-fareast-font-family:"Times New Roman";color:red;mso-farea=
st-language:
EN-US;mso-no-proof:yes'>xmlns:x</span><span style=3D'mso-bidi-font-size:10.=
0pt;
font-family:"Courier New";mso-fareast-font-family:"Times New Roman";color:b=
lue;
mso-fareast-language:EN-US;mso-no-proof:yes'>=3D</span><span style=3D'mso-b=
idi-font-size:
10.0pt;font-family:"Courier New";mso-fareast-font-family:"Times New Roman";
mso-fareast-language:EN-US;mso-no-proof:yes'>&quot;<span style=3D'color:blu=
e'>http://schemas.microsoft.com/winfx/2006/xaml</span>&quot;<o:p></o:p></sp=
an></p>

<p class=3DMsoNormal style=3D'margin-left:.5in;mso-layout-grid-align:none;
text-autospace:none'><span style=3D'mso-bidi-font-size:10.0pt;font-family:"=
Courier New";
mso-fareast-font-family:"Times New Roman";mso-fareast-language:EN-US;
mso-no-proof:yes'><o:p>&nbsp;</o:p></span></p>

<p class=3DMsoNormal style=3D'margin-left:.5in;mso-layout-grid-align:none;
text-autospace:none'><span style=3D'mso-bidi-font-size:10.0pt;font-family:"=
Courier New";
mso-fareast-font-family:"Times New Roman";color:blue;mso-fareast-language:E=
N-US;
mso-no-proof:yes'><span style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp; </spa=
n></span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:red;mso-fareast-language:EN-US;mso-no-proof:yes'>Ti=
tle</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>=
=3D</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'>&quot;<span
style=3D'color:blue'>WindowsApplication14</span>&quot;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'margin-left:.5in;mso-layout-grid-align:none;
text-autospace:none'><span style=3D'mso-bidi-font-size:10.0pt;font-family:"=
Courier New";
mso-fareast-font-family:"Times New Roman";color:blue;mso-fareast-language:E=
N-US;
mso-no-proof:yes'><span style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp; </spa=
n></span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:red;background:aqua;mso-highlight:aqua;mso-fareast-=
language:
EN-US;mso-no-proof:yes'>Loaded</span><span style=3D'mso-bidi-font-size:10.0=
pt;
font-family:"Courier New";mso-fareast-font-family:"Times New Roman";color:b=
lue;
mso-fareast-language:EN-US;mso-no-proof:yes'>=3D</span><span style=3D'mso-b=
idi-font-size:
10.0pt;font-family:"Courier New";mso-fareast-font-family:"Times New Roman";
mso-fareast-language:EN-US;mso-no-proof:yes'>&quot;<span style=3D'color:blu=
e;
background:yellow;mso-highlight:yellow'>OnWindowLoaded</span>&quot;<o:p></o=
:p></span></p>

<p class=3DMsoNormal style=3D'margin-left:.5in;mso-layout-grid-align:none;
text-autospace:none'><span style=3D'mso-bidi-font-size:10.0pt;font-family:"=
Courier New";
mso-fareast-font-family:"Times New Roman";color:blue;mso-fareast-language:E=
N-US;
mso-no-proof:yes'><span style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp; </spa=
n>&gt;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'margin-left:.5in;mso-layout-grid-align:none;
text-autospace:none'><span style=3D'mso-bidi-font-size:10.0pt;font-family:"=
Courier New";
mso-fareast-font-family:"Times New Roman";color:blue;mso-fareast-language:E=
N-US;
mso-no-proof:yes'><span style=3D'mso-spacerun:yes'>&nbsp; </span>&lt;</span=
><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:maroon;mso-fareast-language:EN-US;mso-no-proof:yes'=
>Canvas</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>&=
gt;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'margin-left:.5in;mso-layout-grid-align:none;
text-autospace:none'><span style=3D'mso-bidi-font-size:10.0pt;font-family:"=
Courier New";
mso-fareast-font-family:"Times New Roman";color:blue;mso-fareast-language:E=
N-US;
mso-no-proof:yes'><span style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp; </spa=
n>&lt;</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:maroon;mso-fareast-language:EN-US;mso-no-proof:yes'=
>TextBox</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'> =
</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:red;mso-fareast-language:EN-US;mso-no-proof:yes'>Na=
me</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>=
=3D</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'>&quot;<span
style=3D'color:blue'>textBox1</span>&quot;<span style=3D'color:blue'>&gt;&l=
t;/</span><span
style=3D'color:maroon'>TextBox</span><span style=3D'color:blue'>&gt;<o:p></=
o:p></span></span></p>

<p class=3DMsoNormal style=3D'margin-left:.5in;mso-layout-grid-align:none;
text-autospace:none'><span style=3D'mso-bidi-font-size:10.0pt;font-family:"=
Courier New";
mso-fareast-font-family:"Times New Roman";color:blue;mso-fareast-language:E=
N-US;
mso-no-proof:yes'><span style=3D'mso-spacerun:yes'>&nbsp; </span>&lt;/</spa=
n><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:maroon;mso-fareast-language:EN-US;mso-no-proof:yes'=
>Canvas</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>&=
gt;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'margin-left:.5in;mso-layout-grid-align:none;
text-autospace:none'><span style=3D'mso-bidi-font-size:10.0pt;font-family:"=
Courier New";
mso-fareast-font-family:"Times New Roman";color:blue;mso-fareast-language:E=
N-US;
mso-no-proof:yes'>&lt;/</span><span style=3D'mso-bidi-font-size:10.0pt;
font-family:"Courier New";mso-fareast-font-family:"Times New Roman";color:m=
aroon;
mso-fareast-language:EN-US;mso-no-proof:yes'>Window</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>&=
gt;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:green;mso-fareast-language:EN-US;mso-no-proof:yes'>=
<span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp; </span><o:p></o:p></spa=
n></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:green;mso-fareast-language:EN-US;mso-no-proof:yes'>=
<span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp; </span>// Window1.xaml.=
cs</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'><=
o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp; </span><span
style=3D'color:blue'>private</span> <span style=3D'color:blue'>void</span> =
<span
style=3D'background:yellow;mso-highlight:yellow'>OnWindowLoaded</span>(<span
style=3D'color:blue'>object</span> sender, <span style=3D'color:teal'>Route=
dEventArgs</span>
e) {<o:p></o:p></span></p>

<p class=3DMsoNormal><span style=3D'mso-bidi-font-size:10.0pt;font-family:"=
Courier New";
mso-fareast-font-family:"Times New Roman";mso-fareast-language:EN-US;
mso-no-proof:yes'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;
</span>textBox1.Text =3D <span style=3D'color:maroon'>&quot;Hello World!&qu=
ot;</span>;<o:p></o:p></span></p>

<p class=3DMsoNormal><span style=3D'mso-bidi-font-size:10.0pt;font-family:"=
Courier New";
mso-fareast-font-family:"Times New Roman";mso-fareast-language:EN-US;
mso-no-proof:yes'><span style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;
</span>}<o:p></o:p></span></p>

<p class=3DMsoNormal><u>Option 2: Hooking onto the Loaded event from code<o=
:p></o:p></u></p>

<p class=3DMsoNormal><u><o:p><span style=3D'text-decoration:none'>&nbsp;</s=
pan></o:p></u></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </spa=
n><span
style=3D'color:blue'>public</span> Window1() {<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;
</span>InitializeComponent();<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'><=
span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;
</span><span style=3D'background:aqua;mso-highlight:aqua'>this</span></span=
><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";background:aqua;mso-highlight:aqua;mso-fareast-language:E=
N-US;
mso-no-proof:yes'>.Loaded</span><span style=3D'mso-bidi-font-size:10.0pt;
font-family:"Courier New";mso-fareast-font-family:"Times New Roman";mso-far=
east-language:
EN-US;mso-no-proof:yes'> +=3D <span style=3D'color:blue'>new</span> <span
style=3D'color:teal'>RoutedEventHandler</span>(<span style=3D'background:ye=
llow;
mso-highlight:yellow'>OnWindowLoaded</span>);<span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp; </span><o:p></o:p></span></p>

<p class=3DMsoNormal><span style=3D'mso-bidi-font-size:10.0pt;font-family:"=
Courier New";
mso-fareast-font-family:"Times New Roman";mso-fareast-language:EN-US;
mso-no-proof:yes'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </spa=
n>}<o:p></o:p></span></p>

<p class=3DMsoNormal><span style=3D'mso-bidi-font-size:10.0pt;font-family:"=
Courier New";
mso-fareast-font-family:"Times New Roman";mso-fareast-language:EN-US;
mso-no-proof:yes'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </spa=
n></span><u><o:p></o:p></u></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </spa=
n><span
style=3D'color:blue'>void</span> <span style=3D'background:yellow;mso-highl=
ight:
yellow'>OnWindowLoaded</span>(<span style=3D'color:blue'>object</span> send=
er, <span
style=3D'color:teal'>RoutedEventArgs</span> e) {<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;
</span>textBox1.Text =3D <span style=3D'color:maroon'>&quot;Hello World!&qu=
ot;</span>;<span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;
</span><o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </spa=
n>}<o:p></o:p></span></p>

<h3><a name=3D"_Toc124876577">Tools for Editing XAML</a></h3>

<p class=3DMsoNormal><a
href=3D"http://www.microsoft.com/products/expression/en/interactive_designe=
r/id_features.aspx"><span
style=3D'font-family:Verdana'>Microsoft Expression codenamed
&#8220;Sparkle&#8221;</span></a></p>

<p class=3DMsoNormal><a
href=3D"http://msdn.microsoft.com/msdntv/episode.aspx?xml=3Depisodes/en/200=
51020CiderMB/manifest.xml"><span
style=3D'font-family:Verdana'>Visual Studio codename &#8220;Orcas&#8221; de=
signer
codenamed &#8220;Cider&#8221;</span></a></p>

<p class=3DMsoNormal><a
href=3D"http://winfx.msdn.microsoft.com/library/default.asp?url=3D/library/=
en-us/Wcp_tools/html/bf204eec-81d2-4992-ac70-31ebf57efdba.asp"><span
style=3D'font-family:Verdana'>XamlPad</span></a> </p>

<p class=3DMsoNormal><a
href=3D"http://www.charlespetzold.com/wpf/XamlCruncher/XamlCruncher.applica=
tion"><span
style=3D'mso-ascii-font-family:Tahoma;mso-hansi-font-family:Tahoma'>XamlCru=
ncher</span></a>
(Petzold)</p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<h3><a name=3D"_Toc124876580">Application and MyApp.xaml</a></h3>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal>&#8220;Avalon&#8221; has three kinds of application st=
yles
&#8211; a simple <b style=3D'mso-bidi-font-weight:normal'>Application</b>
(Window-based, just like windows forms), a <b style=3D'mso-bidi-font-weight=
:normal'>NavigationApplication</b>
(page based, just like Microsoft Money or a website), and a <b
style=3D'mso-bidi-font-weight:normal'>DocumentApplication</b> (specialized
sub-set of NavigationApplication for displaying content).</p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal>An &#8220;Avalon&#8221; application can either be run =
in two
modes: <b style=3D'mso-bidi-font-weight:normal'>Express</b> (run from brows=
er)
and <b style=3D'mso-bidi-font-weight:normal'>Installed</b> (behaves like cl=
assic
Windows applications).<span style=3D'mso-spacerun:yes'>&nbsp; </span>Just l=
ike
Windows Forms, &#8220;Avalon&#8221; works with ClickOnce for installation.<=
/p>

<p class=3DMsoNormal><b style=3D'mso-bidi-font-weight:normal'><o:p>&nbsp;</=
o:p></b></p>

<p class=3DMsoNormal><b style=3D'mso-bidi-font-weight:normal'>Files in a si=
mple
Application<o:p></o:p></b></p>

<p class=3DMsoNormal><b style=3D'mso-bidi-font-weight:normal'><o:p>&nbsp;</=
o:p></b></p>

<p class=3DMsoNormal>If you create a new &#8220;Windows Application (WPF)&#=
8221;
in Visual Studio, you&#8217;ll get several files:</p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<ul style=3D'margin-top:0in' type=3Ddisc>
 <li class=3DMsoNormal style=3D'mso-list:l0 level1 lfo2;tab-stops:list .5in=
'>MyApp.xaml</li>
 <ul style=3D'margin-top:0in' type=3Dcircle>
  <li class=3DMsoNormal style=3D'mso-list:l0 level2 lfo2;tab-stops:list 1.0=
in'>Application
      declaration in xaml</li>
 </ul>
 <li class=3DMsoNormal style=3D'mso-list:l0 level1 lfo2;tab-stops:list .5in=
'>MyApp.xaml.cs
     or MyApp.xaml.vb, etc</li>
 <ul style=3D'margin-top:0in' type=3Dcircle>
  <li class=3DMsoNormal style=3D'mso-list:l0 level2 lfo2;tab-stops:list 1.0=
in'>Application
      code behind &#8211; application startup events and so on</li>
 </ul>
 <li class=3DMsoNormal style=3D'mso-list:l0 level1 lfo2;tab-stops:list .5in=
'>Window1.xaml</li>
 <ul style=3D'margin-top:0in' type=3Dcircle>
  <li class=3DMsoNormal style=3D'mso-list:l0 level2 lfo2;tab-stops:list 1.0=
in'>Window
      declaration in xaml</li>
 </ul>
 <li class=3DMsoNormal style=3D'mso-list:l0 level1 lfo2;tab-stops:list .5in=
'>Window1.xaml.cs
     or Window1.xaml.vb, etc</li>
 <ul style=3D'margin-top:0in' type=3Dcircle>
  <li class=3DMsoNormal style=3D'mso-list:l0 level2 lfo2;tab-stops:list 1.0=
in'>Window
      code behind &#8211; event handlers and so on</li>
 </ul>
</ul>

<p class=3DMsoNormal><b style=3D'mso-bidi-font-weight:normal'><o:p>&nbsp;</=
o:p></b></p>

<p class=3DMsoNormal>MyApp.xaml and its codebehind file are most like the
Program.cs from a C# Windows Forms application.<span
style=3D'mso-spacerun:yes'>&nbsp; </span>This is where you&#8217;ll put any=
thing
that applies to the entire application &#8211; typically you may want to
associate resources, styles to be shared between all your Windows in your a=
pplication.</p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal><b style=3D'mso-bidi-font-weight:normal'>Where is
Application.Run? <o:p></o:p></b></p>

<p class=3DMsoNormal>Believe it or not, &#8220;Avalon&#8221; has an
Application.Run too &#8211; to find it we need to talk about what happens w=
hen
you build XAML.</p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal>When you build Avalon takes the .xaml and generates a =
set of
files that are then compiled in to the exe. For &lt;Name&gt;.xaml the follo=
wing
are generated:</p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><b style=3D'mso-bidi-font-w=
eight:
normal'>&lt;Name&gt;.baml <o:p></o:p></b></p>

<p class=3DMsoNormal style=3D'margin-left:1.0in'>Binary version of the .xam=
l file.
Compiled into the .exe as a resource </p>

<p class=3DMsoNormal style=3D'margin-left:1.0in'><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><b style=3D'mso-bidi-font-w=
eight:
normal'>&lt;Name&gt;.g.cs (or .g.vb)<o:p></o:p></b></p>

<p class=3DMsoNormal style=3D'margin-left:1.0in'>Partial class that is comb=
ined
with &lt;Name&gt;.xaml.cs (or .vb). Contains initialization code that does =
the
following:</p>

<p class=3DMsoNormal style=3D'margin-left:1.0in'><o:p>&nbsp;</o:p></p>

<p class=3DBulletedList3><![if !supportLists]><span style=3D'font-family:Wi=
ngdings;
mso-fareast-font-family:Wingdings;mso-bidi-font-family:Wingdings'><span
style=3D'mso-list:Ignore'>&sect;<span style=3D'font:7.0pt "Times New Roman"=
'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]>Loads the baml resource to display the UI</p>

<p class=3DBulletedList3><![if !supportLists]><span style=3D'font-family:Wi=
ngdings;
mso-fareast-font-family:Wingdings;mso-bidi-font-family:Wingdings'><span
style=3D'mso-list:Ignore'>&sect;<span style=3D'font:7.0pt "Times New Roman"=
'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]>Wires up event handlers </p>

<p class=3DBulletedList3><![if !supportLists]><span style=3D'font-family:Wi=
ngdings;
mso-fareast-font-family:Wingdings;mso-bidi-font-family:Wingdings'><span
style=3D'mso-list:Ignore'>&sect;<span style=3D'font:7.0pt "Times New Roman"=
'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><![endif]>Wires up member variables to live objects
(Button1 for example)</p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal>So the build is a two step process &#8211; firstly it
generates this stuff, then it compiles and generates an exe.</p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal><b style=3D'mso-bidi-font-weight:normal'>Peeking at My=
App.g.cs<o:p></o:p></b></p>

<p class=3DMsoNormal style=3D'text-indent:.5in'><span style=3D'mso-bidi-fon=
t-size:
10.0pt;font-family:"Courier New";mso-fareast-font-family:"Times New Roman";
mso-fareast-language:EN-US;mso-no-proof:yes'>[<span style=3D'color:teal'>ST=
AThread()</span>]</span><b
style=3D'mso-bidi-font-weight:normal'><o:p></o:p></b></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span
style=3D'color:blue'>public</span> <span style=3D'color:blue'>static</span>=
 <span
style=3D'color:blue'>int</span> <st1:place w:st=3D"on">Main</st1:place>(<sp=
an
style=3D'color:blue'>string</span>[] args) {<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;
</span>WindowsApplication22.MyApp app =3D <span style=3D'color:blue'>new</s=
pan>
WindowsApplication22.MyApp();<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;
</span>app.InitializeComponent();<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;
</span><span style=3D'color:blue'>return</span> app.Run(args);<o:p></o:p></=
span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </spa=
n>}<o:p></o:p></span></p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal><b style=3D'mso-bidi-font-weight:normal'>So if Main is=
 in an automatically
generated class how do I add stuff to <st1:place w:st=3D"on">Main</st1:plac=
e>?<o:p></o:p></b></p>

<p class=3DMsoNormal><b style=3D'mso-bidi-font-weight:normal'><o:p>&nbsp;</=
o:p></b></p>

<p class=3DMsoNormal>You can hook the StartingUp event on Application to add
custom logic.<span style=3D'mso-spacerun:yes'>&nbsp; </span></p>

<p class=3DMsoNormal><span style=3D'mso-bidi-font-size:10.0pt;font-family:"=
Courier New";
mso-fareast-font-family:"Times New Roman";color:blue;mso-fareast-language:E=
N-US;
mso-no-proof:yes'><o:p>&nbsp;</o:p></span></p>

<p class=3DMsoNormal><span style=3D'mso-bidi-font-size:10.0pt;font-family:"=
Courier New";
mso-fareast-font-family:"Times New Roman";color:blue;mso-fareast-language:E=
N-US;
mso-no-proof:yes'>&lt;!--</span><span style=3D'mso-bidi-font-size:10.0pt;
font-family:"Courier New";mso-fareast-font-family:"Times New Roman";color:g=
reen;
mso-fareast-language:EN-US;mso-no-proof:yes'> MyApp.XAML </span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>-=
-&gt;</span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>&=
lt;</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:maroon;mso-fareast-language:EN-US;mso-no-proof:yes'=
>Application</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'> =
</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:red;mso-fareast-language:EN-US;mso-no-proof:yes'>x:=
Class</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>=
=3D</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'>&quot;<span
style=3D'color:blue'>WindowsApplication22.MyApp</span>&quot;<o:p></o:p></sp=
an></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'><=
span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp; </span></span><span style=3D'mso-bi=
di-font-size:
10.0pt;font-family:"Courier New";mso-fareast-font-family:"Times New Roman";
color:red;mso-fareast-language:EN-US;mso-no-proof:yes'>xmlns</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>=
=3D</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'>&quot;<span
style=3D'color:blue'>http://schemas.microsoft.com/winfx/2006/xaml/presentat=
ion</span>&quot;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'><=
span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp; </span></span><span style=3D'mso-bi=
di-font-size:
10.0pt;font-family:"Courier New";mso-fareast-font-family:"Times New Roman";
color:red;mso-fareast-language:EN-US;mso-no-proof:yes'>xmlns:x</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>=
=3D</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'>&quot;<span
style=3D'color:blue'>http://schemas.microsoft.com/winfx/2006/xaml</span>&qu=
ot;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'><=
span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp; </span></span><span style=3D'mso-bi=
di-font-size:
10.0pt;font-family:"Courier New";mso-fareast-font-family:"Times New Roman";
color:red;mso-fareast-language:EN-US;mso-no-proof:yes'>StartupUri</span><sp=
an
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>=
=3D</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'>&quot;<span
style=3D'color:blue'>Window1.xaml</span>&quot;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'><=
span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp; </span></span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:red;background:lime;mso-highlight:lime;mso-fareast-=
language:
EN-US;mso-no-proof:yes'>Startup</span><span style=3D'mso-bidi-font-size:10.=
0pt;
font-family:"Courier New";mso-fareast-font-family:"Times New Roman";color:b=
lue;
background:lime;mso-highlight:lime;mso-fareast-language:EN-US;mso-no-proof:
yes'>=3D</span><span style=3D'mso-bidi-font-size:10.0pt;font-family:"Courie=
r New";
mso-fareast-font-family:"Times New Roman";background:lime;mso-highlight:lim=
e;
mso-fareast-language:EN-US;mso-no-proof:yes'>&quot;<span style=3D'color:blu=
e'>OnApplicationStartingUp</span>&quot;</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'><o:p></o:p><=
/span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'><=
span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp; </span>&gt;<o:p></o:p></span>=
</p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'><=
span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp; </span>&lt;</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:maroon;mso-fareast-language:EN-US;mso-no-proof:yes'=
>Application.Resources</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>&=
gt;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'><=
span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'><=
span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp; </span>&lt;/</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:maroon;mso-fareast-language:EN-US;mso-no-proof:yes'=
>Application.Resources</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>&=
gt;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>&=
lt;/</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:maroon;mso-fareast-language:EN-US;mso-no-proof:yes'=
>Application</span><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";color:blue;mso-fareast-language:EN-US;mso-no-proof:yes'>&=
gt;<o:p></o:p></span></p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<p class=3DMsoNormal><span style=3D'mso-bidi-font-size:10.0pt;font-family:"=
Courier New";
mso-fareast-font-family:"Times New Roman";color:green;mso-fareast-language:
EN-US;mso-no-proof:yes'><span style=3D'mso-spacerun:yes'>&nbsp; </span>//
MyApp.xaml.cs</span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'><span
style=3D'mso-spacerun:yes'>&nbsp; </span><span style=3D'color:blue'>public<=
/span> <span
style=3D'color:blue'>partial</span> <span style=3D'color:blue'>class</span>=
 <span
style=3D'color:teal'>MyApp</span> : <span style=3D'color:teal'>Application<=
/span> {<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </spa=
n><span
style=3D'color:blue'>private</span> <span style=3D'color:blue'>void</span> =
<span
style=3D'background:lime;mso-highlight:lime'>OnApplicationStartingUp</span>=
(<span
style=3D'color:blue'>object</span> sender, <o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;
</span><span style=3D'color:teal'>StartupEventArgs</span> e) {<o:p></o:p></=
span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;
</span><span style=3D'color:blue'>if</span> (e.Args.Length =3D=3D 1 &amp;&a=
mp;
e.Args[0] =3D=3D <span style=3D'color:maroon'>&quot;/?&quot;</span>) {<o:p>=
</o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><span style=3D'color:teal'>MessageBox</span>.Show(<span style=3D'col=
or:maroon'>&quot;Help!&quot;</span>);<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;
</span>}<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'mso-layout-grid-align:none;text-autospace:non=
e'><span
style=3D'mso-bidi-font-size:10.0pt;font-family:"Courier New";mso-fareast-fo=
nt-family:
"Times New Roman";mso-fareast-language:EN-US;mso-no-proof:yes'><span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </spa=
n>}<o:p></o:p></span></p>

<p class=3DMsoNormal><span style=3D'mso-bidi-font-size:10.0pt;font-family:"=
Courier New";
mso-fareast-font-family:"Times New Roman";mso-fareast-language:EN-US;
mso-no-proof:yes'><span style=3D'mso-spacerun:yes'>&nbsp;&nbsp;&nbsp; </spa=
n>}</span></p>

<p class=3DMsoNormal><b style=3D'mso-bidi-font-weight:normal'><o:p>&nbsp;</=
o:p></b></p>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

</body>

</html>

------=_NextPart_01C6DD70.F0A21EB0
Content-Location: file:///C:/CA4B30D3/XamlApplicationBasics_files/header.htm
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset="us-ascii"

<html xmlns:v=3D"urn:schemas-microsoft-com:vml"
xmlns:o=3D"urn:schemas-microsoft-com:office:office"
xmlns:w=3D"urn:schemas-microsoft-com:office:word"
xmlns:st1=3D"urn:schemas-microsoft-com:office:smarttags"
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=3DContent-Type content=3D"text/html; charset=3Dus-ascii">
<meta name=3DProgId content=3DWord.Document>
<meta name=3DGenerator content=3D"Microsoft Word 11">
<meta name=3DOriginator content=3D"Microsoft Word 11">
<link id=3DMain-File rel=3DMain-File href=3D"../XamlApplicationBasics.htm">
<![if IE]>
<base href=3D"file:///C:\CA4B30D3\XamlApplicationBasics_files\header.htm"
id=3D"webarch_temp_base_tag">
<![endif]><o:SmartTagType
 namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags" name=3D"place"=
/>
</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div style=3D'mso-element:footnote-separator' id=3Dfs>

<p class=3DMsoNormal><span style=3D'mso-special-character:footnote-separato=
r'><![if !supportFootnotes]>

<hr align=3Dleft size=3D1 width=3D"33%">

<![endif]></span></p>

</div>

<div style=3D'mso-element:footnote-continuation-separator' id=3Dfcs>

<p class=3DMsoNormal><span style=3D'mso-special-character:footnote-continua=
tion-separator'><![if !supportFootnotes]>

<hr align=3Dleft size=3D1>

<![endif]></span></p>

</div>

<div style=3D'mso-element:endnote-separator' id=3Des>

<p class=3DMsoNormal><span style=3D'mso-special-character:footnote-separato=
r'><![if !supportFootnotes]>

<hr align=3Dleft size=3D1 width=3D"33%">

<![endif]></span></p>

</div>

<div style=3D'mso-element:endnote-continuation-separator' id=3Decs>

<p class=3DMsoNormal><span style=3D'mso-special-character:footnote-continua=
tion-separator'><![if !supportFootnotes]>

<hr align=3Dleft size=3D1>

<![endif]></span></p>

</div>

<div style=3D'mso-element:header' id=3Deh1>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

</body>

</html>

------=_NextPart_01C6DD70.F0A21EB0
Content-Location: file:///C:/CA4B30D3/XamlApplicationBasics_files/filelist.xml
Content-Transfer-Encoding: quoted-printable
Content-Type: text/xml; charset="utf-8"

<xml xmlns:o=3D"urn:schemas-microsoft-com:office:office">
 <o:MainFile HRef=3D"../XamlApplicationBasics.htm"/>
 <o:File HRef=3D"header.htm"/>
 <o:File HRef=3D"filelist.xml"/>
</xml>
------=_NextPart_01C6DD70.F0A21EB0--
