How to Set Default Window Size for a .NET App on First Opening

When registering .NET applications programmatically with io.Connect Desktop, you can control the initial window size on first launch, while still allowing users to resize the window freely afterward, with their custom sizing preserved for subsequent openings.

How

Use WithWindowOptionsModifier on the IApplicationDefinitionBuilder to set the initial screen bounds when registering your app via RegisterAppFactoryAsync or RegisterWPFApp:

IApplicationDefinitionBuilder::WithWindowOptionsModifier(gwo => gwo.WithScreenBounds(...))

Once the user manually resizes the window, io.Connect Desktop will preserve the user-defined size on subsequent launches as part of its default layout behavior.

Notes

  • The WithWindowOptionsModifier method requires io.Connect.NET 1.35.0 or later.
  • If you try setting window bounds inside the Initialize method of Tick42.AppManager.IGlueAppHandle using glueWindow.Update(MoveResize(...))it will also set the window size. But the set size will be applied at every opening, not just the first time. Moving the window in the initialize state does not work as the system will place it in the proper position according to the layout (or the default position).