2

こんにちは、ビュー ナビゲーションのコードを書きました。そのために、そのボタンのクリックでナビゲーション エリアにボタンを追加しました。コンテンツ エリアでビューを開きたいです。私のコードは次のとおりです。

モジュールコード

public class ClientModule : ModuleBase
    { 

        public ClientModule(IUnityContainer container, IRegionManager regionManager)
            : base(container, regionManager) { }       

        protected override void InitializeModule()
        {
            RegionManager.RegisterViewWithRegion("NavigationRegion", typeof(Navigation));
            RegionManager.RegisterViewWithRegion("ContentRegion", typeof(Content));          
        }

        protected override void RegisterTypes()
        {
            Container.RegisterType<object, Navigation>(typeof(Navigation).FullName);
           Container.RegisterType<object,Content>(typeof(Content).FullName);
        }
    }
}

ブートストラップは

public class Bootstrapper : UnityBootstrapper
    {
        protected override DependencyObject CreateShell()
        {
            return this.Container.Resolve<Shell>();
        }

        protected override void InitializeShell()
        {
            base.InitializeShell();

            App.Current.MainWindow = (Window)this.Shell;
            App.Current.MainWindow.Show();
        }

        protected override void ConfigureContainer()
        {
            base.ConfigureContainer();
            Container.RegisterType<IShellViewModel, ShellViewModel>();
        }

        protected override RegionAdapterMappings ConfigureRegionAdapterMappings()
        {
            RegionAdapterMappings mappings = base.ConfigureRegionAdapterMappings();
            mappings.RegisterMapping(typeof(StackPanel), Container.Resolve<StackPanelRegionAdapter>());
            return mappings;
        }


        protected override void ConfigureModuleCatalog()
        {
            base.ConfigureModuleCatalog();

            ModuleCatalog moduleCatalog = (ModuleCatalog)this.ModuleCatalog;
            moduleCatalog.AddModule(typeof(ClientModule));
        }


    }

私のナビゲーションビューには、以下のように1つのボタンがあります

<StackPanel>
    <Button Command="{x:Static infCommands:ApplicationCommands.NavigateCommand}" 
            CommandParameter="{x:Type views:Content}" 
            Name="btnTest">Navigate to Content</Button>

</StackPanel>

今の問題は、アプリケーションボタンを実行すると常に無効と表示されることです。問題とその解決策を教えてください。

ありがとう

4

1 に答える 1