Using MUI Forms in a Class Library Project

Jul 10, 2013 at 1:42 PM
Hi Guys!,
    I was really excited with the rich look offered by MUI Controls. But I could not use this Forms in a class library project. 

   Does anyone know how to work with MUI Forms in a class library project.
Thanks in Advance,
Balaji A
Jul 10, 2013 at 4:54 PM
Add a reference to the DLL? Or if you mean you want to use it from a Class library project, you'll have to add the references for WPF you'd get from a wpf application.

PresentationCore, PresentationFramework, and of course the Modern UI assembly.
Jul 12, 2013 at 11:12 AM
Hi LarryC42,
          I have referenced all the necessary DLL's. I am able to build my project and execute it. The Problem is when i try to open the MUI form using showdialog.
'The Object reference not set to an instance of an object' Null exception occurs.
         Any idea!..
Thanks,
Balaji A
Jul 14, 2013 at 1:35 PM
At a guess I'd say one of the properties is not set correctly. Can you post an example of the form that's not working?
Jul 15, 2013 at 3:32 PM
Hi Larry Let me explain the scenario in brief,
  The Objective of my work is to customize Autodesk Revit application using C#. So far I am using normal WPF forms. I just wanted to incorporate MUI forms instead of WPF windows.

   I can send a sample application but you need Revit software to debug the source. So if have Revit kindly let me know i will upload a sample in Sky drive and paste the link.

 I have made the following changes in MUI project to convert it to class library project.
  1. Change the following properties of app.xaml
    Build Action: Page
    Copy to Output Directory: Do not copy
    Custom Tool: MSBuild:Compile
  2. Added the following dll to the output path in addition to my project output dll by setting copy local to TRUE
    WindowsBase.dll
    PresentationFramework.dll
    PresentationCore.dll
    Microsoft.Windows.Shell.dll
    FirstFloor.ModernUI.xml
    FirstFloor.ModernUI.dll

    This is the error I got when i place a try catch block in my code.! Image http://sdrv.ms/18guYay

    This is the error i received from Revit Application Image http://sdrv.ms/13dDvd4

    Kindly have a look at those images in skydrive.

    Thanks a lot for spending your valuable time Larry!
Thanks,
Balaji A
Jul 15, 2013 at 11:58 PM
Well, I don't see anyway to make that fail unless you're not calling from a WPF application. I get the same error if I create a Windows forms application and try to call that method. It fails because there is no current application.
Jul 16, 2013 at 7:04 AM
Is there any way to make it work by converting the MUI form to User Control library!

Thanks,
Balaji A
Jul 16, 2013 at 10:22 AM
I don't know much about either type of hosting. You could try something like this:

http://stackoverflow.com/questions/3564791/run-wpf-application-from-a-windows-form

Hopefully someone else will have some better ideas. You might want to try a post on a general WPF/Windows Forms board somewhere.