Unable to navigate using ContentControl region and RegionManager.RequestNavigate

Topics: Prism v4 - WPF 4
May 13, 2011 at 3:47 PM

RegionManager.RequestNavigate does not update my ContentControl. The NavigationResult.Result comes back True, and I can drill down into the region in the debugger and see the view inside it, but the UI never shows the new view. Perhaps it is not setting it to active?

The oddest part is that it works perfectly fine in Silverlight. Any help?

 

<ContentControl Height="200" Width="200" Background="BlanchedAlmond" x:Name="MainContent" Regions:RegionManager.RegionName="MAIN">
_regionManager.RequestNavigate("Main", ViewNames.USER_SUMMARY, OnNavigationCallback);

May 13, 2011 at 4:15 PM

Hi,

It could be helpful if you could provide us with a repro sample (for example SkyDrive) of your solution, so that we can help you find out the cause of the unexpected behavior you're experiencing.

Thanks,

Miguel Bronzovic
http://blogs.southworks.net/mbronzovic

 

May 13, 2011 at 4:23 PM
Edited May 13, 2011 at 4:37 PM

 

http://cid-a3388b7fbf17cf82.office.live.com/self.aspx/.Public/PrismPad.zip

 

when you run the app, click on the "User Manager" button. The code is in LaunchButtonViewModel.cs Sorry for posting such a trivial problem but I've looked everywhere for an explanation.

 

Thanks!

May 13, 2011 at 8:56 PM

Hi,

After debugging your application we’ve found that your shell window was not being correctly initialized and shown on the screen. This caused the UI not reflected the changes when you navigate to the second view.

We modified your Bootstrapper class like this:

public class Bootstrapper : UnityBootstrapper
{
       protected override DependencyObject CreateShell()
       {
           var shell = new Shell();
           this.Container.RegisterInstance<Shell>(shell);
           Application.Current.MainWindow = shell;
           return shell;
       }

       protected override void InitializeShell()
       {
           this.Container.Resolve<Shell>().Show();
       }
…

We also modified the App.xaml file, removing the StartUpUri property.

After modifying the CreateShell method, overriding the InitializeShell method in the Bootstrapper and removing the StartUpUri property in the App.xaml file, the sample worked correctly.

Please let me know if this information helps you.

Thanks,

Miguel Bronzovic
http://blogs.southworks.net/mbronzovic

 

May 13, 2011 at 10:07 PM

Thank you very much!