Answered Frame.Navigation and e.Paramater issues

  • Thursday, May 03, 2012 4:04 PM
     
      Has Code

    I'm wiring view models up to the view by passing in the view model in the e.paramater, then in the onNavigateTo I'm doing this:-

    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
          this.DataContext = e.Parameter;
    }

    Certain pages are used to create items, so I don't really want a user navigating back to those pages. I achieve this by modifying the navigation state (using Frame.SetNavigationState), however when users press back the e.parameter is null.

    An example might help:-)

    Page A [Navigate to B] Page B [Navigate Back] Page A (e. parameter is remembered)

    Page A [Navigate to B] Page B [Navigate To C, Modify Stack To Remove B] Page C [Navigate B] Page A (e. parameter is now null)

    Is there anyway around this? I'm guessing it's a bug :-/

All Replies