views:

557

answers:

1

I'm surprised to notice that my right click code no longer works in-browser for Silverlight 3. I think the problem could be that in SL2 I was using the asp Silverlight control and setting the property Windowless=true. That control was removed in SL3 and now I'm using an object tag to display Silverlight content. How can I get this to work again? Code is:

ctor()
{
  HtmlPage.Document.AttachEvent("oncontextmenu", OnContextMenu);
}

public void OnContextMenu(object sender, HtmlEventArgs e)
{
  MessageBox.Show("Right click.");
  e.PreventDefault();
}
+2  A: 

Include in your object tags param list the following param:-

<param name="windowless" value="True" />

I'm surprised to here that the asp:silverlight control is gone? Are you sure?

AnthonyWJones
Oh yes, it's gone ;) Check Tim Heuer's "what's new" post for more info.
James Cadd
Many thanks, that works great.
James Cadd
@JC: So it is, interesting. I'm somewhat skeptical of the "object is more flexible" reasoning though.
AnthonyWJones