Skip to content

Cannot initialize window as maximized #21435

@MartinZikmund

Description

@MartinZikmund

Discussed in #21339

Originally posted by Tad29Eng August 22, 2025
I create desktop app, how to startup main app window in maximize size (same as pressing maximize button in window)

I try use in App.xaml.cs

 var presenter = (OverlappedPresenter)MainWindow.AppWindow.Presenter;
 presenter.Maximize();

but this not worked, when app runing exception thrown: System.NullReferenceException Microsoft.UI.Windowing.OverlappedPresenter.Maximize()

Metadata

Metadata

Assignees

Labels

area/windowingCategorizes an issue or PR as relevant to window managementdifficulty/medium 🤔Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions