WindowsAppSDK-Samples
WindowsAppSDK-Samples copied to clipboard
(Winui3/C++) How to correctly initialize the data of the window class (e.g., MainWindow).
C++ WinUI 3 examples are really scarce.
I need to initialize the following code:
sourceList().ItemsSource(sourceArray);
struct MainWindow : MainWindowT<MainWindow>
{
MainWindow()
{
// Xaml objects should not call InitializeComponent during construction.
// See https://github.com/microsoft/cppwinrt/tree/master/nuget#initializecomponent
//When I initialize here, an error occurs. I think it's because the component is not fully initialized.
sourceList().ItemsSource(sourceArray);
}
...
Where should I elegantly and right implement the initialization of this code?
// Xaml objects should not call InitializeComponent during construction. // See https://github.com/microsoft/cppwinrt/tree/master/nuget#initializecomponent This actually already told you.