I am skeptical regarding the XML namespaces. I don't know why we need these namespaces 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 that in our classes because we have class libraries that sit on the same computer.
Questions:
It represents some URI. So WPF is standalone application. If the user of the app is not connected to Internet, whats the significance of it? First of all why do we need this?
What's the difference between the first and second line? What does xmlns:x
represent?
Also, I see this error upon trying to access that URI
An error occurred while processing your request
What does this mean?
The URLs mentioned in the definitions of the namespaces have nothing to do with actual internet-connection or real existing URLs; this is just a convention used so the namespaces can be properly distinguished.
A XAML-namespace is just like a namespace in C++ or C#/VB.NET, it serves the purpose of logically grouping classes and other items.
In WPF/XAML you have a namespace xmlns=http://...
which is the namespace for the controls WPF offers you by default. xmlns:x
is a namespace to provide some special values like x:Null
to represent a null
-value.
You can define your own controls and name them TextBox
, too, but you should create an own namespace for these in order to not interfer with the global namespace.
There is a nice article on MSDN about this topic.