希望这不会是一个一般性的问题,但它涉及到Catel示例提供的关于Github的纪念品示例。
由于某些原因,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 发布于 2015-02-12 15:57:04
看来纪念品服务还没有注册。这是因为您可能只使用该接口。接口不是.NET加载程序集的原因。
有几件事可以解决:
当然,您也可以创建一个解决这个问题的PR来帮助其他人使用这些例子。
https://stackoverflow.com/questions/28481375
复制相似问题