views:

127

answers:

2

In every XAML document, there are one or more namespace declarations. ie:

<Window x:Class="WindowsApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1 Height="300">

The declarations are in the form of a URL, leading me to ask: Does the runtime actually retrieve information from those URLs when the application loads? What happens if no Internet connection is present?

+1  A: 

This is just a standqard xml namespace and nothing special to do with XAML at all. It is really just a unique identifier for this particular xml; no data is retrieved from this url and, in fact, it doesn't even need to be a url.

See this previous post for an explanation of what a namespace is in xml, and why the actual namespace text itself is of no real consequence.

Rob Levine
A: 

No. The runtime does not dereference the URIs, they are just used as readable globally unique identifiers. The fact that they use an http protocol at all is just a convention. They follow the XML Namespace standard from W3C.

The URIs refer to the URIs defined using the XmlnsDefinitionAttribute defintions in the WPF assemblies. The XAML reader uses these attributes to group CLR namespaces from those assemblies together into a combined XML namespace.

chuckj