Introduction :This Bolg introduced the Full-Screen Mode with Trusted Applications.
In trusted applications, you can enter full-screen mode in a Application.Startup or FrameworkElement.Loaded event handler.
However, you must do so by setting the IsFullScreen property in a delegate passed to the
Dispatcher.BeginInvoke method.
When a Silverlight-based application is in full-screen mode, its size is equal to the current resolution of the screen.
With Silverlight 4, this changes as there is now the notion of a “Trusted” Silverlight application
which can go beyond the Sandbox in a number of ways including calling out to native code on the machine.
So, a Silverlight application is always running.
1. For security reasons, Full Screen can only be enabled in an event that was fired by the user, such as a Button click event.
private void button1_Click(object sender, RoutedEventArgs e)
{
Application.Current.Host.Content.IsFullScreen = !Application.Current.Host.Content.IsFullScreen;
//Application.Current.Host.Content.Resized += new EventHandler(Content_Resized);
Application.Current.Host.Content.IsFullScreen = true;
}
It is possible to go into Full Screen mode without user interaction in Silverlight 4's Trusted Application.
2.A Silverlight-based application can enter full-screen mode only in response to a user-initiated action. This means that you can programmatically switch to full-screen mode
only in a user-input event handler.
3.An elevated application can go full-screen without requiring explicit user-interaction to drive that full-screen mode. So, an application could go full-screen as soon as it loads with something like.
public MainPage()
{
InitializeComponent();
Loaded += new RoutedEventHandler(MainPage_Loaded);
}
void MainPage_Loaded(object sender, RoutedEventArgs e)
{
if (Application.Current.HasElevatedPermissions)
{
Application.Current.Host.Content.IsFullScreen = true;
}
}
When (Application.Current.HasElevatedPermissions) is false,it will not set to fullscreenMode.
If we set Enable running application out of Browser to true and Require elevated trust when running outside the browser to true,then
Application.Current.HasElevatedPermissions, this condition will be true and it set full screen mode to true.
that means Application.Current.Host.Content.IsFullScreen = true.
Example :
Example of an OutOfBrowserSettings.xml file with the elevated setting.
<OutOfBrowserSettings ShortName="SilverlightApplication3 Application" EnableGPUAcceleration="False" ShowInstallMenuItem="True">
<OutOfBrowserSettings.Blurb>SilverlightApplication3 Application on your desktop; at home, at work or on the go.</OutOfBrowserSettings.Blurb>
<OutOfBrowserSettings.WindowSettings>
<WindowSettings Title="SilverlightApplication3 Application" />
</OutOfBrowserSettings.WindowSettings>
<OutOfBrowserSettings.Icons />
<OutOfBrowserSettings.SecuritySettings>
<SecuritySettings ElevatedPermissions="Required"/>
</OutOfBrowserSettings.SecuritySettings>
</OutOfBrowserSettings>