Hello @21939029 ,
Welcome to Microsoft Q&A!
Your code is ok.
You can refer to the example of Window Class
, and the startup method of MainWindow
.
winrt::Microsoft::UI::Xaml::Window window{ nullptr };
void App::OnLaunched(LaunchActivatedEventArgs const&)
{
window = make<MainWindow>();
window.Activate();
}
Thank you.
Junjie
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.