Most commonly, you
interact with your Silverlight application as a
component as part of a larger web page. There are
many cases, though, where you would want your
undivided attention to be paid to your Silverlight
application - such as when you are watching a movie
or playing with some Deep Zoom content.
In those cases, you
can give your users the ability to run your
application in full screen. To see an example of
what this looks like, click on the Full Screen
button in the below example:
When you clicked on
the Toggle Full Screen button, your Silverlight
application will have gone, as expected, full screen
where your taskbar, browser buttons, etc. are all
hidden from view. Clicking the button again will
return you back to the application's default size.
The code for
doing this is fairly straightforward:
The code can be
summarized as follows. You check to see whether you
are currently in full screen mode. If you are not,
then you switch into full screen mode. If you are
already in full screen mode, then you will return to your default,
In the above line, I
have an if
statement that checks whether you are currently in
full screen mode or not. I accomplish that via
checking what the value of
is. This statement returns a
false depending on
whether your application is in full screen or not.
I am not doing a
straightforward comparison. I am actually negating
the value returned by the IsFullScreen property by
using the ! (exclamation mark). What this if
statement actually says is "If
Application is NOT Full Screen" then do
something, otherwise, do something else.
When your if statement
determines you are not currently in full screen
mode, the following line gets executed:
In this line, we are setting our IsFullScreen
property to false, and this returns your view back
to its original state where your Silverlight
application is back to its normal size.
Keyboard and Mouse in Full
Screen When you are in full screen mode,
though, your keyboard and mouse functionality is
reduced for security reasons. You only have mouse
button, arrow keys, and space bar support. You do
not have the ability to use other keys on your
keyboard or the mouse wheel.
If you have questions, need some assistance on this topic, or just want to
chat - post in the comments below or drop by our friendly forums
(where you have a lot more formatting options) and post your question. There are
a lot of knowledgeable and witty people who would be happy to help you out
Did you enjoy reading this and found it useful? If so, please share it with
If you didn't like it, I always like to hear how I can do better next time.
Please feel free to contact me directly at kirupa[at]kirupa.com.