c# - Why does IDependecyResolver.Resolve<IUICompositionService>() method throw exception 'Catel.IoC.TypeNotRegisteredException'? -
i have exception 'catel.ioc.typenotregisteredexception' when try resolve iuicompositionservice interface. added reference catel.extensions.prism , installed loadassembliesonstartup.fody nuget wpf mvvm catel project , in app.xaml.cs in app.onstartup() method wrote following code:
var servicelocator = new servicelocator(); servicelocator.registertypesusingdefaultnamingconvention();
in mainwindowviewmodel in command method wrote following code visualizing calibrationview view in application mainwindow:
private void showcalibrationviewexecute() { var viewmodel = new calibrationviewmodel(); var dependencyresolver = this.getdependencyresolver(); var uicompositionservice = dependencyresolver.resolve<iuicompositionservice>(); uicompositionservice.activate(viewmodel, "mainregion"); }
for view there calibrationmodel , calibrationviewmodel classes in application. when press showcalibrationview button in mainwindow toolbar , showcalibrationviewexecute method calls in line
var uicompositionservice = dependencyresolver.resolve<iuicompositionservice>();
exception catel.ioc.typenotregisteredexception thrown. exception reports: the specified type 'catel.services.iuicompositionservice' not registered or not constructed. please register type before using it. type 'catel.services.iuicompositionservice' not registered. how can correct , eliminate error? i'm doing wrong?
p.s. have followin catel's references in project: catel.core, catel.extensions.controls, catel.extensions.prism, catel.fody.attributes, catel.mvvm.
make sure implement bootstrapper takes care of type registration. check out examples in examples repository, contains several prism examples.
Comments
Post a Comment