Infosys Microsoft Alliance and Solutions blog

« Claims Based Authentication | Main | Virtual Earth ASP.NET control »

Silverlight 2.0 - Interaction with HTML DOM

Back to the place I like the most. There are a lot many things that have happened in the last few months on Silverlight 2.0. The developer community of Silverlight is upbeat and I am sure that the excitement is here to stay. I have been working a few applications on Silverlight are there is a lot of curiosity about how Silverlight will change the future of the applications in the web space. All this apart, I've had my hands on the technology for sometime now and was able to see a lot many things possible now (though there many more to come). The best part of the story is the interaction between the HTML DOM and the Silverlight Sandbox.

We can interact with the HTML DOM/Script objects from the Managed .NET Code of the Silverlight Application. This opens up a lot many possibilities in Application development. A few of the things that I tried out were:

- Set the status bar of the IE window to the link which I want to navigate to on the click of a button
- Check whether the DOM/Script bridge is enabled or disabled

To have this interaction between the Managed Silverlight code and the HTML DOM, the DOM/Script bridge of the Silverlight Framework must be enabled. To do this, we can set the property "HtmlAccess" of the Silverlight Plugin (in either HTML or ASP .NET )  to "Enabled".

Below is a simple example where the Status Bar of the IE Window is set on the "MouseOver" event of the Silverlight Button and a message is displayed with the name of the browser.

When DOM/Script Bridge is "Enabled":

HTML Access Enabled

When DOM/Script Bridge is "Disabled":

 HTML Access Disabled

This is just a tip of the iceberg and there is a lot much one can play around. You can download the code for the above sample here.

Watch out this space for more!

TrackBack

TrackBack URL for this entry:
http://www.infosysblogs.com/microsoft-mt/mt-tb.fcgi/261

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

Please key in the two words you see in the box to validate your identity as an authentic user and reduce spam.

Subscribe to this blog's feed

Infosys on Twitter