希望这不是一般问题,但它涉及Github上Catel例子提供的纪念品示例。
由于某种原因,MainWindow的数据上下文没有设置为MainWindowViewModel。这个例子本身并不起作用。我之前已经显示过日志,但有些消息让我感到困惑(我猜不了解)。感谢帮助。
09:21:00:182 => [DEBUG] [Catel.IoC.ServiceLocator] Registered type 'Catel.MVVM.IViewModelFactory' to instance of type 'Catel.MVVM.ViewModelFactory'
09:21:00:182 => [DEBUG] [Catel.MVVM.Providers.LogicBase] Using IViewModelFactory 'Catel.MVVM.ViewModelFactory' to instantiate the view model
09:21:00:183 => [DEBUG] [Catel.IoC.TypeFactory] Creating instance of type 'MomentoProject.ViewModels.MainWindowViewModel' using specific parameters. No constructor found in the cache, so searching for the right one
'MomentoProject.vshost.exe' (CLR v4.0.30319: MomentoProject.vshost.exe): Loaded 'C:\Users\Haytham\Documents\Visual Studio 2013\Projects\Catel\Catel2\App2\output\Debug\Catel.Extensions.Memento.dll'. Symbols loaded.
09:21:00:191 => [DEBUG] [Catel.IoC.TypeFactory] Checking if constructor 'public ctor(IUIVisualizerService uiVisualizerService, IMessageService messageService, IMementoService mementoService)' can be used
09:21:00:191 => [DEBUG] [Catel.IoC.TypeFactory] Constructor is not valid because parameter 'mementoService' cannot be resolved from the dependency resolver
09:21:00:192 => [DEBUG] [Catel.IoC.TypeFactory] The constructor is valid and can be used
09:21:00:192 => [DEBUG] [Catel.IoC.TypeFactory] No constructor could be used, cannot construct type 'MomentoProject.ViewModels.MainWindowViewModel' with the specified parameters
09:21:00:193 => [DEBUG] [Catel.MVVM.ViewModelFactory] Could not construct view model 'MomentoProject.ViewModels.MainWindowViewModel' using injection of data context 'null'
09:21:00:193 => [DEBUG] [Catel.MVVM.Providers.LogicBase] Used IViewModelFactory to instantiate view model, the factory did NOT return a valid view model
09:21:00:195 => [DEBUG] [Catel.MVVM.Views.ViewToViewModelMappingHelper] Initializing view model container to manage ViewToViewModel mappings
09:21:00:216 => [DEBUG] [Catel.MVVM.Views.ViewToViewModelMappingHelper] Initializing view model 'null'
09:21:00:217 => [DEBUG] [Catel.MVVM.Views.ViewToViewModelMappingHelper] Initialized view model 'null'
09:21:00:217 => [DEBUG] [Catel.MVVM.Views.ViewToViewModelMappingHelper] Initialized view model container
答案 0 :(得分:1)
看起来memento服务尚未注册。这是因为您可能只使用该界面。接口不是.NET加载程序集的原因。
有几件事要解决这个问题:
您当然也可以创建一个解决此问题的公关,以帮助其他人使用这些示例。