Yuriy Vikulov
Yuriy Vikulov

Reputation: 2499

prism navigation: I can requestnavigate to only one particular view

Im using prism 4.0, wpf,

I create RegionAdapter for devx DocumentGroup.

I have a view which is shown as content of DocumentPanel(child of DocumentGroup). I register view in container. everything fine. I can request view into the region of DocumentGroup.

container.RegisterType<Object, NatLossesView>("NatLossesView",new TransientLifetimeManager());

The problem: I can create only one view in DocumentGroup items. For example, my program is loaded, no document on the panel. I do

var NatLossesViewU = new Uri("NatLossesView", UriKind.Relative); regionManager.RequestNavigate("DocumentGroupRegion", NatLossesViewU);

The view is shown. I'd like to create one more instance of view, but calling previous code does nothing. After I close the view, I can call my code and the view is shown again

SOLVED

I've solved my issue myself. ViewModel has to implement INavigationAware interface. method IsNavigationTarget should be like this:

public bool IsNavigationTarget(NavigationContext navigationContext)
{
            //throw new NotImplementedException();
            return false;
}

Upvotes: 2

Views: 1851

Answers (1)

Jimmy
Jimmy

Reputation: 3264

assuming in your region adpater you are making sure the added view is properly added to your docnwindowgroup items list - try following code,

var NatLossesViewobj = _container.Resolve<NatLossesView>() 
regionManager.AddToRegion("DocumentGroupRegion", NatLossesViewobj);

Upvotes: 1

Related Questions