NavigationParameter.Data is always null

1 reply. Last post: August 27, 2014 12:01 AM by Yudi
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback
Michel SmitMember

Hi, 

I am trying to reuse a view model across multiple tabs in a MultiPageViewModelBase subclass and simply make it base its data on a parameter, but no matter what I try, the parameter data is always null in my viewmodel's Navigated() method.

Simple reproducible scenario:

public class MyTabViewModel : MultiPageViewModelBase, IChildViewModel
{
               public MyTabViewModel()
               {
                              var parameter1 = "Section 1";
                              var parameter2 = "Section 2";

                              var items = new List<NavigationItem>();
                              items.Add(new NavigationItem("First Tab", new NavigationTarget(typeof(MySectionViewModel), new NavigationParameter(parameter1))));
                              items.Add(new NavigationItem("Second Tab", new NavigationTarget(typeof(MySectionViewModel), new NavigationParameter(parameter2))));

                              this.Items = items.ToArray();                                     
               }
}

public class MySectionViewModel : DataListViewModelBase<MyItem, IMyRepository>, IChildViewModel
{
               public override void Navigated(NavigatedParameter parameter)
               {
                              // parameter.Data is always null!
               }
}

Another issue: an overridden ShouldNavigate() in MyTabViewModel never gets called.

Any help would be greatly appreciated, but it seems like a bug that is really blocking our project progress, because we need this approach for dynamic data which isn't known beforehand.

All times are GMT -5. The time now is 1:47 PM.
Previous Next