1.

What do you mean by xmlns and xmlns:x in WPF?

Answer»

XAML (Extensible Application Markup Language) UI elements can be defined/resolved using the xmlns and xmlns:X NAMESPACES. As the default namespace, xmlns aids in resolving all WPF elements. XAML language definitions are resolved using the xmlns:x namespace. This is prefixed by the “x:” CHARACTER

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

A good example is the XAML snippet below, in which there are 2 elements - "StackPanel" and "X:name". A "StackPanel" element is resolved using the default namespace and an "x:name" element using the "xmlns:x" namespace. 

<StackPanel x:Name="myStack" />


Discussion

No Comment Found