wpf - Caliburn.Micro - why uses UserControl instead of Window -
my question in title. i'm starting caliburn.micro mvvm approach (which new me) , in every tutorial first step remove default mainwindow.xaml file , create new usercontrol file. why that? usercontrol not accept title. isn't possible build application using normal windows? tried that, every launch error "cannot find view viewmodel", although both mainview.xaml , mainviewmodel.cs present. when created pair of usercontrol , viewmodel it, started work expected. again, why windows don't work? wouldn't problem, i'm thinking additions modern ui themes wpf might not work without window. i'm not sure of that.
probably 1 solution display defined usercontrol view inside of window, it's workaround.
you create own custom shell window creating custom windowmanager
:
public class customwindowmanager : windowmanager { protected override window createwindow(object rootmodel, bool isdialog, object context, idictionary<string, object> settings) { window window = new window(); window.title = "custom..."; return window; } }
...that register in bootstrapper:
public class hellobootstrapper : bootstrapperbase { ... protected override void configure() { _container.singleton<iwindowmanager, customwindowmanager>(); ... } }
Comments
Post a Comment