Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. Creating a c++ cli mixed mode assembly inherited from a WPF library not possible?

Creating a c++ cli mixed mode assembly inherited from a WPF library not possible?

Scheduled Pinned Locked Moved WPF
helpcsharpwpflearningc++
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    alleyes 0
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups