views:

371

answers:

2

I have a 100% silverlight application that takes up the entire screen.

Plan A: I would like to embed other silverlight ads but I cannot find any companies that provide this service.

Plan B: Embed classic HTML ads into the app. I've found one way by playing around the with DIV's and Javascript but it seems like a major hack. do not want.

Anyone managed to display ads with silverlight?

+2  A: 

the possible solution may be "you can use web service which feed ad-data to SL application, and then display it."

bugBurger
You mean like feeding xaml to an area reserved for advertising? Do any companies provide such xaml?
vidalsasoon
I don't think any company will be providing xaml ads but you can convert it to xaml using custom code.
bugBurger
A: 

All silverlight application are embeded in html using object, for example:

<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">

It means you still can have other html element in the page where you have silverlight. You even can create new html elements and add that to the page in your code behind.

So one solution is to create a div element in the page that is hosting silverlight and show it in front of silverlight object using z-index. And there are atleast two ways to implement this solution:

  1. In code behind. Way to access html element in code behind file:

    HtmlElement mydiv = HtmlPage.Document.GetElementByID("mydiv");

  2. Using javascript

It is a workaround, but we have to stick with it until silverlight can embed html inside it.

ajitdh

related questions