0

ウィンザー城を IoC として使用し、UI で mvvm のプリズムを使用したいと考えていました。

そこで、すべてのクラスをウィンザー ブートストラップに登録します。

            Container.Register(
            Classes.FromThisAssembly()
                .Pick()
                .WithServiceAllInterfaces()
                .WithServiceSelf()
                .WithServiceBase()
                .LifestyleTransient());

次に、ビューに移動したい:

RegionManager.RequestNavigate(RegionNames.SideBarRegion, "PreEventNavigationView");

その後、例外がスローされます。スタック トレースからの重要な情報は次のとおりです。

{"Activation error occurred while trying to get instance of type Object, key \"PreEventNavigationView\""}

{"Requested component named 'PreEventNavigationView' was not found in the container. Did you forget to register it?\r\nThere are 55 other components supporting requested service 'System.Object'. Were you looking for any of them?"}

コンポーネントを登録する必要があると思いましsystem.objectたが、それも役に立ちませんでした。これにより、UI が機能せず、奇妙な動作が発生します。

        Container.Register(
            Component.For<PreEventNavigationView,System.Object>()
                .ImplementedBy<PreEventNavigationView>().LifestyleSingleton());

オブジェクトをウィンザー城に登録してはならないことをどこかで読んだと思います。ウィンザー城で Prism Navigation を正しく使用するにはどうすればよいですか、または不可能ですか?

4

1 に答える 1