11

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?

4

3 回答 3

35

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.

于 2015-08-02T04:31:05.383 回答
4

And in C++ :

Windows::UI::ViewManagement::ApplicationView::PreferredLaunchWindowingMode = 
Windows::UI::ViewManagement::ApplicationViewWindowingMode::FullScreen;
于 2015-10-24T16:27:12.430 回答
1

try this:

this.InitializeComponent();
ApplicationView.GetForCurrentView().TryResizeView(new Size(1360, 768));
于 2020-06-03T11:23:55.580 回答