WinUI3 : Lifecycle of the window

Harshithraj1871 1,446 Reputation points
2022-12-22T12:03:12.243+00:00

Hi,

I wanted to check lifecycle of the WinUI3 window, when it will be cleared from the memory and who will be responsible for clearing all the content of the window and the window itself. What will happen when the window close is triggered and who is responsible for clearing all the contents of the window in WinUI3 desktop app.

I tried checking online for the official documentation on windows lifecycle, but was not able to find it.

It would be of great help if you could point me to the right documentation

Thank you

Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
720 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,513 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Xiaopo Yang - MSFT 11,251 Reputation points Microsoft Vendor
    2022-12-23T05:52:02.367+00:00

    Hello,

    Welcome to Microsoft Q&A!

    A Window is created by new or equivalents and is closed by Window.Close Method or Application.Exit Method.
    An instance of the object that is specified by the root element of the XAML file is maintained by WindowsAppSDK and you must free your resources.

    Thank you.

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.