I have the following C# code for Windows platform:
namespace FigureCollapse.WinUI
{
public partial class App : MauiWinUIApplication
{
public App()
{
//AssignAppData() is responsible for selecting the application's data storage folder depending on the platform.
AppData.AsignAppData(ApplicationData.Current.LocalFolder.Path, true);
//SelectAppLang() is responsible for selecting the language of the app depending on the configuration file stored in AppData
Lang.SelectAppLang(AppData.AppConfig["Language"]);
this.InitializeComponent();
}
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
}
I want to be able to do four things:
- That the user cannot change the size of the window.
- That depending on the configuration file data stored in AppData (in this case it would be AppConfig["Resolution"]) is the size of the displayed window.
- Depending on the data in the configuration file, it is known whether the app is in window mode or full screen mode.
- Disable the option to maximize/minimize app window size
I was trying for a long time how to do it but I couldn't with the first point.
I tried searching the documentation, Google and chatGPT. The documentation didn't mention much, Google didn't show me results, and ChatGPT gave me broken, non-working code.
You can go to the
App.xaml.csinPlatforms\Windowsdirectory and use WinUI3's AppWindow feature.So, that would be something like this:
To go to fullscreen (or quit it) you use AppWindowPresenterKind Enum like this for example: