WinUI3 : Lifecycle of the window

Anonymous
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.
434 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.
2,627 questions
No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Xiaopo Yang - MSFT 5,851 Reputation points Microsoft Employee
    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.