Is possible create Dynamic tabs with Multi page ViewModel?

5 replies. Last post: October 21, 2015 6:15 AM by Arief Handany
Tags :
  • New Discussion
  • New Question
  • New Product Feedback

I want to create a MultiPageViewModel that I don't know how many tab have.

Inside of ViewModel I request to webservice the number of tabs should have my MultiPageViewModel.

After, i try to create my NavigationItems with this response.

public override void Navigated(NavigatedParameter parameter)
{
   GetCategories();
   this.UpdateResources();
}


public async void GetCategories()
{
   try
   {
      this.ActivityPresenter.Show("Cargando los datos del socio...", ActivityStyle.LargeIndicator);

      var result = await Repository.GetCategories();
      if (result != null)
      {
         List items = new List();
         foreach (var category in result)
         {
            items.Add(new NavigationItem(string.Format("{0}({1})", category.Category, category.News), typeof(TabsListViewModel)));
         }

         this.Items = items.ToArray();
         this.UpdateResources();
      }
   }
   catch (Intersoft.Crosslight.RestClient.HostUnreachableException)
   {
      this.MessagePresenter.Show(
          "Connection error...");
   }
   catch (Exception ex)
   {
      this.MessagePresenter.Show("Error: 0x0002");
   }
   finally
   {
      this.ActivityPresenter.Hide();
   }
}
Make this is possible?
All times are GMT -5. The time now is 10:05 PM.
Previous Next