WP7 Navigation not working for me

Nov 30, 2010 at 1:16 AM

I am not sure why I am having a hard time with this...  I can't make it work.

My app starts on 

MainPageViewModel : Conductor<object>

This class will determine whether to show a login page or if already logged in, show the app's homage page (HomePage.xaml).

Something like this:

if(IsLoggedIn)

    _navigationService.Navigate(new Uri("/homepage.xaml",UriKind.Relative));

else

    ActivateItem(_createLogin());

The problem is that the navigate method always fails.  An ArgumentException with Message = "SelectedItem" is thrown in this method in the PropertyChangedBase class

 

        void RaisePropertyChangedEventCore(string propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
                handler(this, new PropertyChangedEventArgs(propertyName));
        }

 

What am I doing wrong?

Coordinator
Nov 30, 2010 at 2:48 AM

What is in your main page view? If you have a pivot in there, my guess would be that you are hitting the infamous pivot databinding bug.

Nov 30, 2010 at 3:23 AM
I am not using a pivot on the main page.

I am using a simple content control that is named ActiveItem
Nov 30, 2010 at 2:25 PM

Anyone?  I cannot navigate to any page page from my app and I don't want to use one global conductor that handles all the pages.  Plus the conductor doesn't handle the back button events e.g.  if conductor activates view A then I click a button to show view B, hitting the back button doesn't take me back to View A.

Why can't I navigate to any page?

Thanks in advance for your help.

Coordinator
Nov 30, 2010 at 3:12 PM

Have you read through this article? http://caliburnmicro.codeplex.com/wikipage?title=Working%20with%20Windows%20Phone%207&referringTitle=Documentation

Nov 30, 2010 at 3:34 PM
I read it several times :)

Can you give me an example project of how to use the navigate method from a VM?

MY email is eibrahim at gmail
Nov 30, 2010 at 3:47 PM

It seems you are using it the right way.

Can you please provide the stack trace for the exception?
I can't understand where the SelectedItem message come from...

 

 

 

Nov 30, 2010 at 4:32 PM

I went to replicate it and somehow it got fixed!!!...  I dug around and realized that it WAS the pivot fix issue but the weird thing is that I didn't have a pivot on my main page, I had it on the receiving page (the one I am trying to navigate to).

Anyway, it is magically resolved :)

Thanks.