标签:成功 软件 rip pps repr end win10 cli .com
win10 能够全屏软件或窗体。窗体有一般、最小化、最大化。我们有新的API设置我们软件是全屏,是窗体。
我们能够使用ApplicationView
让我们软件全屏,取消。
以下是一个简单的样例,推断我们软件是不是全屏,假设是,就不全屏,代码在一个ToggleButton
ApplicationView view = ApplicationView.GetForCurrentView();
bool isInFullScreenMode = view.IsFullScreenMode;
if (isInFullScreenMode)
{
view.ExitFullScreenMode();
}
else
{
view.TryEnterFullScreenMode();
}
IsFullScreenMode
为true。如今应用全屏
ExitFullScreenMode
退出全屏
TryEnterFullScreenMode
进入全屏,进入全屏成功true
假设窗体改变须要知道,能够注冊Window.Current.SizeChanged
public class IsFullScreenModeTrigger : StateTriggerBase
{
public IsFullScreenModeTrigger()
{
ApplicationView view = ApplicationView.GetForCurrentView();
SetActive(view.IsFullScreenMode);
Window.Current.SizeChanged += CurrentWindow_SizeChanged;
}
private void CurrentWindow_SizeChanged(object sender, Windows.UI.Core.WindowSizeChangedEventArgs e)
{
ApplicationView view = ApplicationView.GetForCurrentView();
SetActive(view.IsFullScreenMode);
}
}
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState x:Name="InFullScreen">
<VisualState.StateTriggers>
<local:IsFullScreenModeTrigger />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="IsFullScreenText.Text" Value="In full screen mode" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<StackPanel HorizontalAlignment="Center">
<Button Click="Button_Click"
Content="Toggle full screen"></Button>
<TextBlock x:Name="IsFullScreenText"
FontSize="72"
TextWrapping="Wrap"
Text="Not in full screen mode"/>
</StackPanel>
</Grid>
在我们应用变为全屏,textblock就会In full screen mode
我们能够设置PreferredLaunchWindowingMode
,在我们应用打开
ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;
ApplicationViewWindowingMode能够Auto
,PreferredLaunchViewSize
设置窗体和ApplicationView.PreferredLaunchViewSize
,假设没有设置ApplicationView.PreferredLaunchViewSize
会使用上次关闭窗体, FullScreen
win10有非常easy的API能够应用全屏,在电脑。我们常常常使用窗体,手机常常使用全屏。
http://igrali.com/2015/06/21/full-screen-mode-in-windows-10-universal-apps/
标签:成功 软件 rip pps repr end win10 cli .com
原文地址:http://www.cnblogs.com/gavanwanggw/p/7255807.html