pencilCake
pencilCake

Reputation: 53243

What is the difference between x:Name="someName" in SL and ID="someID" in Asp.Net?

I have an Asp.Net background and trying to learn Silverlight.

Can you explain, what is the difference between x:Name="someName" in Silverlight, XAML and ID="someID" in Asp.Net markup?

(If they both make a element unique, why one is called Name and the other is called ID ? )

Upvotes: 1

Views: 86

Answers (1)

iCollect.it Ltd
iCollect.it Ltd

Reputation: 93571

I gather compatibility with ASP.Net was not one of the requirements considered when they designed Silverlight (which derived in turn from WPF) :)

"ID" is a very technical term whereas "Name" is a bit more human readable. They are after all just the matching name of a member of the code-behind class generated at compile time. ID as a term makes more sense for data keys etc.

Classic ASP, and then ASP.Net, date back to before WPF and way before Silverlight so the naming is going to be a bit more old-school. Being more recent the naming of most elements tends to be a bit more sensible in Silverlight (compared to ASP).

Note: This is all just my opinion based on working with all the above technologies for many years. Hope it helps.

Upvotes: 1

Related Questions