Silverlight OnFullScreenChange and AddEventListener()
I spent too long this weekend trying to hookup an event handler to the OnFullScreenChange event in my Silverlight 1.0 application using something like the following:
this.plugIn.content.addEventListener("OnFullScreenChange", Silverlight.createDelegate(this, this.onFullScreenChanged));
And various variations of "onFullScreenChanged", "FullScreenChanged", "fullScreenChanged" etc. All I got from Silverlight was a rather unhelpful:
There's a critical statement in the documentation for AddEventListener which I had overlooked:
"The AddEventListener method registers an event listener on a UIElement-derived object, such as a Canvas or Image."
The content object is not a UI-Element derived object - it's not the same thing as your root element (canvas). This is somewhat confusing but Ian Griffiths has a great description over here. What you need to do instead is simply:
this.plugIn.content.onfullScreenChange = Silverlight.createDelegate(this, this.onFullScreenChanged);