Introduction: As a high storey building cannot be build on loose foundation, similarly a rich Silverlight application cannot be made without solid foundation and clear understanding of XAML.
XAML Extensible Application Markup language is a markup language used to instantiate .NET objects. Although XAML is a technology that can be applied to many different problem domains, it was initially designed as a part of Windows Presentation Foundation (WPF).
Conceptually, XAML plays a role that’s a lot like HTML, and is even closer to its stricter cousin, XHTML. XHTML allows you to define the elements that make up an ordinary web page. Similarly, XAML allows you to define the elements that make up a XAML content region.
XAML Namespace: Before continuing, take a look at this bare-bones XAML document, which represents a blank page (as created by Visual Studio). The lines have been numbered for easy reference:
mc:Ignorable=”d” d:DesignWidth=”640″ d:DesignHeight=”480″>
Let’s start observing each of line;
1) <UserControl>: When you use an element like <UserControl> in a XAML file, the Silverlight parser recognizes that you want to create an instance of the UserControl class. However, it doesn’t necessarily know what UserControl class to use. After all, even if the Silverlight namespaces only include a single class with that name, there’s no guarantee that you won’t create a similarly named class of your own. Clearly, you need a way to indicate the Silverlight namespace information in order to use an element. There are four namespaces by default
xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation : Is the core Silverlight namespace. It encompasses all the essential Silverlight classes, including the UserControl and Grid.
xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml : It includes various XAML utility features that allow you to influence how your document is interpreted. This namespace is mapped to the prefix x. That means you can apply it by placing the namespace prefix before the name of an XML element or attribute (as in <x:ElementName> and x:Class=”ClassName”).
xmlns:d=”http://schemas.microsoft.com/expression/blend/2008″: is a namespace reserved for design-specific XAML features that are supported in Expression Blend (and now Visual Studio 2010). It’s used primarily to set the size of the design surface for a page. The DesignWidth and DesignHeight properties are a part of it.
xmlns:mc=http://schemas.openxmlformats.org/markup-compatibility/2006 : the XAML compatibility namespace. You can use it to tell the XAML parser what information must to process and what information to ignore.
(not: daha sonra Türkçeye çevrilecektir)
diğer bir kaynaktan:
namespace’i wpf deki controls System.Windows.Controls. kontrollerine eşleştiriliyor.
namespace’i System.Windows.Markup ile eşleştiriliyor.