-
Notifications
You must be signed in to change notification settings - Fork 7
IInitializeWithWindowHelper
HO-COOH edited this page Mar 22, 2026
·
2 revisions
| Name | IsDependencyProperty | Description |
|---|---|---|
N/A |
❌ | No corresponding WinUI3Package IDL runtimeclass was found for this component. |
A header-only helper for initializing WinRT objects that requires a hwnd.
To use, simply change the namespace winrt to WinUIEssentials of your objects that needs to be initialized, and pass either a HWND or a Microsoft.UI.Xaml.Window to the constructor.
Take FileOpenPicker as an example:
#include <include/IInitializeWithWindowHelper.hpp>
WinUIEssentials::Windows::Storage::Pickers::FileOpenPicker picker{ MainWindow::Hwnd };
//or
WinUIEssentials::Windows::Storage::Pickers::FileOpenPicker picker{ MainWindow::Instance };
//...
picker.PickSingleFileAsync();