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.
Got a question or just want to chat? Comment below or drop by our forums (they are actually the same thing!) where a bunch of the friendliest people you'll ever run into will be happy to help you out!
When Kirupa isn’t busy writing about himself in 3rd person, he is practicing social distancing…even on his Twitter, Facebook, and LinkedIn profiles.
Hit Subscribe to get cool tips, tricks, selfies, and more personally hand-delivered to your inbox.