Why are XAML namespace URIs and what are they for?

I am skeptical about XML namespaces. I don't know why these namespaces are needed in all XAML applications.

xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml 

I understand the concept of namespaces, as in System.Text, System.LINQ, etc. We use this in our classes because we have class libraries that reside on the same computer.

Questions:

  • It represents some URI. Thus, WPF is a standalone application. If the user of the application is not connected to the Internet, what is its meaning? First of all, why do we need this?

  • What is the difference between the first and second lines? What does xmlns:x mean?

  • Also, I see this error when trying to access this URI

    An error occurred while processing your request

    What does it mean?

+4
source share
3 answers

The XAML namespace is similar to the namespace in C ++ or C # / VB.NET, it serves to logically group classes and other elements.
In WPF / XAML, you have the xmlns=http://... namespace, which is the namespace for the controls that WPF offers you by default. xmlns:x is a namespace that provides some special values, such as x:Null to represent null values.
You can define your own controls and call them TextBox too, but you must create your own namespace for them so as not to interfere with the global namespace.
The URLs mentioned in the namespace definitions have nothing to do with the actual internet connection or the actual existing URLs, it’s simple, namespaces can be properly allocated. There is a good article on MSDN about this topic.

+2
source

This is what these namespaces were called. All this. You should not treat them like Uri. As for xmlns vs xmlns: x is the first default namespace that contains wpf controls, the second is the namespace that contains some additional declarations (x: Type, x: Name, etc.).

+1
source

I know this is an old thread, but I think the information provided in response is not entirely correct. The URL you see is not a namespace, but a collection of namespaces grouped into one. Below are some namespaces from .net that are displayed by default in the namespace (url)

System.Windows, System.Windows.Automation, System.Windows.Controls, System.Windows.Controls.Primitives, System.Windows.Data, System.Windows.Documents

0
source

All Articles