What is difference between ‘Name’ and ‘x:Name’ in Xaml ?

Published on April 26, 2015 by Senthil Kumar

Filed under XAML

Last modified April 26, 2015

Print this page

rate 1 star rate 2 star rate 3 star rate 4 star rate 5 star
Your rating: none, Average: 3 (2 votes)

This article have been viewed 15252 times

When working with a control in Xaml (WPF/Silverlight/Windows Phone /Windows Store App) , you will notice that for a control , there are 2 options to specify the name for the control . One using “Name” property and other using “x:Name” property.

What is difference between ‘Name’ and ‘x:Name’ in Xaml ?

Both the properties refer to the same item . We generally use x:Name when defining a UserControl.

The Name property can be used only for descendants of FrameworkElement and FrameworkContentElement where as x:Name can be used for all the Xaml elements

Leave a Comment


You might be Interested in these Posts

Can you run a Windows 10 Universal Apps on Windows 8.1 ?

This is one of the frequently asked question by most of the developers who are new to Windows 10 App...

How to get the Computer Name in C# ?

When working on a Winforms or Console application using C# , sometimes you might need to get the com...

Creating Button in XAML in WPF and Windows Store App

Below is a sample Xaml code that is used to create a button in WPF and Windows Store App. <Butto...