Friday, October 4, 2013

FullScreen in Silverlight Sample

Add Reference System.Windows.Browser
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.Interop;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace FullScreen
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
App.Current.Host.Content.FullScreenOptions
= FullScreenOptions.StaysFullScreenWhenUnfocused;
}
private void FullScreenButtonClick(object sender, RoutedEventArgs e)
{
if (App.Current.Host.Content.IsFullScreen)
{
(sender as Button).Content = “Enter full screen”;
App.Current.Host.Content.IsFullScreen = false;
}
else
{
(sender as Button).Content = “Exit full screen”;
App.Current.Host.Content.IsFullScreen = true;
}
}
}
}

No comments:

Post a Comment