LoadXaml throws a warning "does not inherit from x: Class"
Posted: 04 Oct 2020, 09:57
I have a class hierarchy:
Designer XAML
This is how the Designer class is instantiated correctly
And this is how it issues a warning,
"Component type 'WindowEx' does not inherit from x:Class type 'DesignerMainWindow'.."
The window is created, but the style specified in WindowEx is not inherited
Code: Select all
class WindowEx : public NoesisApp::Window
{
...
};
class DesignerMainWindow : public WindowEx
{
...
};
Code: Select all
<Window
x:Class="DesignerMainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">
<Grid/>
</Window>
Code: Select all
auto symbol = Symbol("DesignerMainWindow");
if (Factory::IsComponentRegistered(symbol)) {
if (auto component = DynamicPtrCast<WindowEx>(Factory::CreateComponent(symbol))) {
component->SetIsActive(true);
component->Show();
return;
}
}"Component type 'WindowEx' does not inherit from x:Class type 'DesignerMainWindow'.."
Code: Select all
auto root = Noesis::GUI::LoadXaml("Designer/DesignerMainWindow.xaml");
if (auto wnd = DynamicPtrCast<WindowEx>(root)) {
}