Using a different main window

Topics: UI Architecture
Dec 1, 2013 at 1:02 PM
Edited Dec 1, 2013 at 1:03 PM
I want to use a different main window than the one Caliburn creates if the view is of type UserControl.
I found the answer that I should use a class derived from Window instead of UserControl Discussion 406523. But now I get a System.TypeInitializationException at last line within Action.SetTargetCore (Message.SetHandled).
The main window is of type Fluent.RibbonWindow.
Any help appreciated.
Thanks in advance
Dec 1, 2013 at 7:48 PM
Edited Dec 1, 2013 at 7:48 PM
xaml some code to see what you are doing will help, viewmodel for the main window and how you are configuring your bootstrapper.. doesn't have to be super detailed but needs to be enough to see how you are trying to do it... help us help you..

Dec 2, 2013 at 5:51 PM
Edited Dec 2, 2013 at 6:21 PM
Thank you for the fast answer. So what I'm doing ... IMO nearly nothing. I just replaced the usercontrol for the view with Fluent:RibbonWindow as it was the answer by Bladewise some months ago. So my code is identical to the tutorial at, just the AppView type changed.

Found another post, unfortunately the bootstrapper code isn't shown here and using this code with the tutorial bootstrapper leads to the same exception.
Dec 3, 2013 at 4:20 AM
hopefully bladewise will see this post cause I am afraid I won't be much use, never really played with that ribbon stuff not a huge fan...
Dec 3, 2013 at 9:18 AM
Edited Dec 3, 2013 at 7:35 PM
I've just mocked up a sample project, using NuGet packages for both CM and Fluent. You can download it here.

As far as I can see, no TypeInitializationException is thrown, so there is something wrong with your code. Such kind of error can happen if an assembly is not already loaded when needed (and the environment fails to load it), or an exception is thrown while initializing a class (i.e. during a static constructor 'call'). Can you provide the full stacktrace?
Marked as answer by Renegr973 on 12/3/2013 at 11:21 AM
Dec 3, 2013 at 7:20 PM
To bad I've deleted that project because I was annoyed about such a strange exception I didn't understand. So at first, Bladewises application is running fine. But attention, there's a troyan horse on mediafire page (at least McAfee warned me).

I've now done all the things I did on weekend, created new project, removed mainwindow, added references, bootstrapper, viewmodel and view, run it and it works fine.
Anyway, many thanks for your help. It's really appreciated and encourages me to use Caliburn instead of using Catel, which at first glance this was easier to understand from my POV.
Dec 3, 2013 at 7:34 PM
Catel is a nice framework, IMHO, yet it is quite large and even too much 'complete'.
I know it sounds strange to consider 'completeness' a flaw, but personally, I love (maybe too much) developing stuff myself... and CM leverages just the most painful parts of development, leaving me the possibility to go deeper. It has a fast learning curve, and most developers I had time to show it too, felt almost instantly pleased by the powerfullness and simplicity. Well, it's just my opinion, tho! :)

Regarding MediaFire, I tend to consider McAfee a bit too inclined to false positives, that said, I replaced the link with a Sky Drive one. :)
Dec 3, 2013 at 7:50 PM
I'm coming from C++ and when WTL was coming up, I was quite impressed about its language features and flexibility far away from MFC and the elegance to work with windows, messages and message maps. In short, I also like libraries which give me the chance to attach my code and wanted behavior at many possible places without hooking deep into the library itself.