Hello.
I am at the point of pulling out my hair - I register 2 views with a regionManager and at start up the correct view is loaded into the region.
I am trying to exchange / replace / deactivate / navigate the initial view with / to the second.
I am at the point of pulling out my hair - I register 2 views with a regionManager and at start up the correct view is loaded into the region.
I am trying to exchange / replace / deactivate / navigate the initial view with / to the second.
//Bootstrapper.cs
protected override void ConfigureContainer()
{
base.ConfigureContainer();
Container.RegisterType<object, StartupControl>(typeof(StartupControl).FullName);
Container.RegisterType<object, MusicGeneration>(typeof(MusicGeneration).FullName);
}
//StartupViewModel.cs
//First attempt at navigation - StartupControl gets deactivated (and removed as it should)
//However <ContentControl regions:RegionManager.RegionName="mainContentRegion"/> //never swaps out the view to MusicGeneration
var region = regionManager.Regions["mainContentRegion"];
region.Deactivate(region.Views.ToArray()[0]);
region.Activate(region.Views.ToArray()[1]);
//I have done this as well, where view is the actual view
regionManager.Regions["mainContentRegion"].RequestNavigate(view.ToString());
///For reference - here is StartUpControl.cs
public partial class StartupControl : IConfirmNavigationRequest, IRegionMemberLifetime
{
public StartupControl(IUnityContainer container)
{
InitializeComponent();
DataContext = container.Resolve<StartupViewModel>();
}
public void OnNavigatedTo(NavigationContext navigationContext)
{
}
public bool IsNavigationTarget(NavigationContext navigationContext)
{
return false;
}
public void OnNavigatedFrom(NavigationContext navigationContext)
{
}
public void ConfirmNavigationRequest(NavigationContext navigationContext, Action<bool> continuationCallback)
{
continuationCallback(true);
}
public bool KeepAlive { get { return false; } }
}
Please assist