Gets any object in the Silverlight object hierarchy by referencing the object's x:Name or Name
attribute value.
| XAML | Cannot use methods in XAML. |
| Scripting | retval = silverlightObject.content.FindName(objectName)
|
Parameters
| objectName | string The name of the object to get. |
Return Value
object
A reference to the specified object if the object was successfully found;
otherwise, returns null.
Examples
The following JavaScript example shows how use the FindName method:
| JavaScript |
function onLoaded(sender, eventArgs)
{
// Retrieve a reference to the plug-in.
var slPlugin = sender.getHost();
// Retrieve a reference to the specified object.
var object = slPlugin.content.findName("myTextBlock");
// If a valid object reference, display an alert dialog box.
if (object != null)
{
alert(object.toString() + " found");
}
}
|
Applies To
Silverlight Plug-in
See Also
Silverlight Object Models and Scripting to the Silverlight Plug-in
Referencing and Modifying Silverlight Objects