Code Interaction
So far, you've seen how a Silverlight application can reach into the browser to perform navigation and manipulate HTML elements. The one weakness of this approach is that it creates tightly bound code—in other words, a Silverlight application that has hard-coded assumptions about the HTML elements on the current page and their unique IDs. Change these details in the HTML page, and the Silverlight code for interacting with them won't work anymore.
One alternative that addresses this issue is to allow interaction between code, not elements. For example, your Silverlight application can update the content of the HTML page by calling a JavaScript method that's in the page. Essentially, the JavaScript code creates an extra layer of ...
Get Pro Silverlight 5 in VB now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.