You??™ll also fill in
the three italicized bits with the appropriate information, as explained here:
??? Prefix is the XML prefix you want to use to indicate that namespace in your XAML
markup. For example, the XAML language uses the x: prefix.
??? Namespace is the fully qualified .NET namespace name.
??? AssemblyName is the assembly where the type is declared, without the .dll extension.
This assembly must be referenced in your project. If you want to use your project
assembly, leave this out.
CHAPTER 2 n XAML 47
For example, here??™s how you would gain access to the basic types in the System
namespace and map them to the prefix sys:
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Here??™s how you would gain access to the types you??™ve declared in the MyProject namespace
of the current project and map them to the prefix local:
xmlns:local="clr-namespace:MyNamespace"
Now, to create an instance of a class in one of these namespaces, you use the namespace
prefix:
nTip Remember, you can use any namespace prefix you want, as long as you are consistent throughout
your XAML document. However, the sys and local prefixes are commonly used when importing the System
namespace and the namespace for the current project. You??™ll see them used throughout this book.
Pages:
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155