What is the difference between xmlns and xmlns:x in WPF ?


Bothe namespaces helps to define / resolved XAML UI elements.
The first namespace is the default namespace and helps to resolve overall WPF elements.

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

The second namespace is prefixed by “x:” and helps to resolve XAML language definition.

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

For instance for the below XAML snippet , we have two things one is the “StackPanel” and the
other is “x:name”. “StackPanel” is resolved by the default namespace and the “x:name” is
resolved by using “xmlns:x” namespace.

<StackPanel x:Name="myStack" />