-
Notifications
You must be signed in to change notification settings - Fork 264
Closed
Description
With #1130, InitializeComponent is now called internally as part of winrt::make instead of within the constructor. This means that the following scenario, by default, does not work anymore:
- Class A is a base class using XAML.
- Class B derives from class A in metadata, and uses XAML too.
- Both are within the same project, so
implementation::Bdirectly derives fromimplementation::A, instead of using WinRT composition.
C++/WinRT will call class B's InitializeComponent function, but the XAML compiler did not generate code in class B's InitializeComponent function to call class A's InitializeComponent function. As a result, nothing from class A is loaded: none of the XAML is visible, no event handlers are attached, x:Bind bindings are not set up, trying to access a x:Name'd control gives nullptr, ets.
To fix this, a user has to explicitly go and add the following in implementation::B:
void B::InitializeComponent()
{
A::InitializeComponent();
BT::InitializeComponent();
}These kinds of things should be transparent to the user.
Metadata
Metadata
Assignees
Labels
No labels