Front-end Page code:
<UserControl x: Class = "SilverlightApplicationDome. fullScreenDome"
Xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml"
Xmlns: d = "http://schemas.microsoft.com/expression/blend/2008"
Xmlns: mc = "http://schemas.openxmlformats.org/markup-compatibility/2006"
Mc: Ignorable = "d"
D: DesignHeight = "300" d: DesignWidth = "400">
<Grid x: Name = "LayoutRoot" Background = "White">
<Image Name = "full" Source = "img/3.jpg" Stretch =" UniformToFill "> </Image>
<Button Name = "btnFull" Width = "120" Height = "80" Content = "full screen display" FontSize = "24" Click = "btnFull_Click"> </Button>
</Grid>
</UserControl>
In fact, it is very simple. We only need to reference the namespace, System. Windows. Interop.
The background code is as follows:
Using System;
Using System. Collections. Generic;
Using System. Linq;
Using System. Net;
Using System. Windows;
Using System. Windows. Controls;
Using System. Windows. Documents;
Using System. Windows. Input;
Using System. Windows. Media;
Using System. Windows. Media. Animation;
Using System. Windows. Shapes;
Using System. Windows. Interop;
Namespace SilverlightApplicationDome
{
Public partial class fullScreenDome: UserControl
{
Public fullScreenDome ()
{
InitializeComponent ();
}
Private void btnFull_Click (object sender, RoutedEventArgs e)
{
Content contentObject = Application. Current. Host. Content;
ContentObject. IsFullScreen =! ContentObject. IsFullScreen;
}
}