问题
I have application with target windows 8.1 and when I run this application on Windows 10, it is run in small window by default.
Because it is primary tablet application I need it to run in full-screen mode by default. Is it possible to set it somewhere in Visual Studio or in some config of the application?
回答1:
To launch application in full screen mode, try setting ApplicationView.PreferredLaunchWindowingMode
as early as in App.xaml.cs
's constructor
public App()
{
ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.FullScreen;
To have a button that toggles the full screen mode, do
var view = ApplicationView.GetForCurrentView();
if (view.IsFullScreenMode)
{
view.ExitFullScreenMode();
}
else
{
view.TryEnterFullScreenMode();
}
However, I need to add that even without specifying any of the code above, when you open your app inside a Windows 10 tablet or a Windows 10 desktop with Tablet Mode enabled, the app will automatically maximise itself to full screen.
As long as your app is available on Windows 10 Desktop devices, I would recommend you not to set it to full screen at start-up 'cause UX wise it's a lot easier for desktop users to work with windowed applications.
回答2:
And in C++ :
Windows::UI::ViewManagement::ApplicationView::PreferredLaunchWindowingMode =
Windows::UI::ViewManagement::ApplicationViewWindowingMode::FullScreen;
回答3:
try this:
this.InitializeComponent();
ApplicationView.GetForCurrentView().TryResizeView(new Size(1360, 768));
来源:https://stackoverflow.com/questions/31758775/windows-10-universal-app-run-in-fullscreen-mode-by-default