Using Caliburn Micro in class library
See original GitHub issueI have a class library which contains several user controls. This library uses caliburn micro to bind the UserControls
to their corresponding ViewModels
using x:Name
approach in the same class library.
Now I have an host application which hosts these UserControls
in a Window. But this host application doesn’t use Caliburn Micro at all. Then how can I initialize caliburn bootstrapper in the library itself.
HostApplication:
<Window>
<ContentControl>
<library:MainUserControl DataContext="{Binding MainUserControlViewModel}"/>
</ContentControl>
</Window>
Class Library
<UserControl x:Class="MainUserControl">
<ContentControl x:Name="OtherUserControlInSameLibrary"/>
</UserControl>
I tried to inherit Bootstrapper
base class like AppBootstrapper: Bootstrapperbase
and passing false to constructor parameter useApplication
. And then I called Initialize()
method. But still conventions are not applied.
MainUserControlViewModel Constructor
public MainUserControlViewModel()
{
AppBootstrapper appBootstrapper = new AppBootstrapper();
appBootstrapper.Initialize();
if (Debugger.IsAttached)
LogManager.GetLog = type => new DebugLog(type);
}
BootstrapperBase override
public class AppBootstrapper : BootstrapperBase
{
public AppBootstrapper():base(false)
{
}
}
I also tried to run caliburn debugger but nothing is showed in my output window.
Issue Analytics
- State:
- Created 8 years ago
- Comments:10 (4 by maintainers)
Top GitHub Comments
hello , Is Resolved your question ?Using Caliburn Micro in class library
I’m as well in pursuit of building a class library using CM. In my case I build Revit add-ins which is loaded from a dll. Is it at all possible? I can use some parts of CM, but others like ActivateItem does not work out of the box.