views:

194

answers:

2

Hi there, I am playing around and trying to learn silverlight4. I have an existing asp.net page with and area of 600 * 400px available for my silverlight form.

My silverlight application has 2 usercontrols. The 1st usercontrol contains a listview of some data, when a user clicks on a list item I display the 2nd usercontrol.

Is it possible from the 2nd usercontrol to call a clientside function within the page so I can have a similar effect as a modal popup?

Any help would be great!!!!

+1  A: 

You should derive your second control from ChildWindow (and make a search on the web for examples of using ChildWindow). This control is designed to deliver this modal pattern you are after.

AnthonyWJones
Thanks Anthony thats what I am looking for.That works however my whole screen isnt a silverlight application I only have an area that the silverlight is embedded into.So when the application runs the modal view is only appearing in the area assigned to the silverlight. Can I somehow make the entire webpapge have the modal effect?
@diver-d: Combine this with Jeremy's suggestion any you'll have a solution. Just note that if some reason you have the `windowless` parameter of the silverlight plug-in set to true then you will need to make sure the plugin appears above the overlay DIV in the html z-order.
AnthonyWJones
+1  A: 

You can create the modal effect by overlaying the page with a div. Here is a tutorial for creating the modal DIV in the HTML/Javascript:

http://raventools.com/blog/2911/create-a-modal-dialog-using-css-and-javascript

Once you it set up, whenever you wish to trigger it, simply use the DOM interaction from Silverlight to fire the overlay:

Html.Window.Invoke("overlay");
Jeremy Likness