LA.NET [EN]

May 03

You can do this from javascript or from C# (when you”re using the alpha version). To achieve full screen mode from javascript , you need to get a reference to the silverlight host control and then you need to access its content property:

referenceToHostControl.content.fullscreen = true;

When you”re building an alpha application, you can write your “code-behind” in C#. In these cases, you can set your page to full mode by accessing the BrowserHost object:

BrowserHost.IsFullScreen = true;

There is still one thing that bothers me: it seems like you can only change the mode from “action” event fired by Silverlight objects (ex.: MouseEnter event). I tried changing the mode during the Loaded event (in C# and in javascript) but doing that simply didn”t work out. I”ve also tried to change the mode in response to an event fired by an HTML control and it also didn”t work out….not sure on why it didn”t work…

8 comments so far

  1. Christopher Bennage
    12:00 pm - 5-4-2007

    Can you imagine a whole new breed of Silverlight ads that go fullscreen on load? Ugh, I”m glad they don”t allow it. 🙂

  2. Luis Abreu
    2:48 pm - 5-4-2007

    yeah…i can agree that it might not make sense for most cases (if not all). However, i don”t agree that you can only make it in response to an event fired by a silverlight control…

  3. akhil
    4:55 pm - 5-6-2007

    This is actually in response to only user initiated events. It is more of a safety/security feature. The intent is to disallow apps that take over the desktop and give the perception of being the computer screen.

  4. Luis Abreu
    7:59 pm - 5-6-2007

    Hello.
    well, i understand that, even though i still think that it should be possible to do that from an html control event…

  5. Dimiz0r
    12:59 pm - 5-9-2007

    sry to bother you guys…

    but i”m trying to use the fullscreen option with C#..
    Could you tell me where I can find the “BrowserHost” object ?

    Thx in advance

  6. Luis Abreu
    1:08 pm - 5-9-2007

    it”s in the system.silverlight dll, on the System.Windows.Hosting namespace.

  7. aditya
    12:05 pm - 5-18-2007

    no it isnt,

    using System.Windows.Interop

    BrowserHost.isFullScreen = true/false

  8. Luis Abreu
    12:38 pm - 5-18-2007

    Yeah, you«”re right….the other is internal.