Silverlight 1.1 lacked a managed equivalent of JavaScript’s window.alert, so when I wanted to pop up a message box (actually, an alert box) in Silverlight 1.1, I used the platform’s DOM integration features to fire a scriptable event from C# and handle the event in JavaScript. Then, in the event handler, I called window.alert.

There’s no need for such shenanigans in Silverlight 2.0 because you can call window.alert via a managed wrapper:

HtmlPage.Window.Alert(“Error!”);

HtmlPage.Window contains a reference to an HtmlWindow object representing the browser window. You can also use HtmlWindow.AttachEvent to register managed handlers for mousewheel events, making it relatively easy to process mousewheel events in Silverlight 2.0 without the intervention of JavaScript. I’ll provide an example in a future blog post.