Welcome to MSDN Blogs Sign in | Join | Help

Knowledgecast

Interesting solutions to interesting problems
Assigning a Name to a Silverlight Element

I answered this in a comment earlier today but I figured this was something that deserved a post of its own. There seems to be some confusion around how to set the name (x:Name in XAML) of a Silverlight object in code. Here's how it's done:

object.SetValue(FrameworkElement.NameProperty, "objectName");

This has the same affect as setting x:Name in XAML. The name property is a dependancy property implemented by the FrameworkElement abstract base class. This class is inherited by most Silverlight elements.

Posted: Friday, July 18, 2008 11:25 AM by Arunjeet Singh
Filed under:
Leave a Comment

(required) 

(required) 

(optional)

(required) 

  
Enter Code Here: Required

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker