Creating a c++ cli mixed mode assembly inherited from a WPF library not possible?
-
I have a WPF application created that during development lives as an EXE application. All works without issue as an EXE. I wish to convert that to a DLL and to call it from a mixed-mode EXE written in C++/CLI. I want to create an inherited class that inherits from the WPF class (MainWindow). I changed the target of the WPF app to that of a library. I removed the App.xml from the solution and changed the Output type to class library.
In the CLR app I create the following class:
public ref class MyInheritedForm : public WPFNameSpace::MainWindow
{
public:
MyInheritedForm ()
{}
};
[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
MyInheritedForm^ test = gcnew MyInheritedForm;
test->Show();
return 0;
}The problem occurs in the constructor of the base class (MainWindow) in the InitializeComponent() call. The error is:
An unhandled exception of type 'System.Exception' occurred in PresentationFramework.dll
Additional information: The component 'MyInheritedForm' does not have a resource identified by the URI '/WPFNameSpce;component/mainwindow.xaml'.
I think this "MAY" be possible but clearly there are fundamental problems. Additionally, in Nishant Sivakumar's book there is an example (FirstAvalonDerived) that crashed with the same error, at the same location. Perhaps it's a VS2010 problem as I would assume the example was tested.
Can someone write back if there is a workaround solution to this. This is a huge problem for any systems that were written in WinForms and now dead-ended due to this bug in WPF.
Thanks for any help.