Google News
logo
WPF - Interview Questions
What do you mean by xmlns and xmlns:x in WPF?
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" />
Advertisement