Using FreshMVVM what is the best approach for navigating to a tabbed page?

I am currently implementing an app with FreshMVVM. I need to support the following workflow and I have yet to come up with a way to do this without stepping outside of FreshMVVM management of viewmodels, etc.:

Standard Page -> StandardPage -> Tabbed Page

The reason for the tabbed page is the design is asking for a workflow like data enter... Do step 1, click next tab, Do step 2, etc.

I have the standard page to standard page navigation working find with out of the box PushPageModel. While I can navigate to the base tabbed page using the same approach, I am unsure on how to navigate to the tabs once I am in there short of programatically configuring the page to show specific children tabs. Of course, if I do this, I lose the ability to just have my viewmodels be included into the push of the new page.

Thoughts?

Tagged:

Best Answer

Answers

  • JonathanSauterJonathanSauter CAMember

    This works perfectly, thank you!

  • JamesLaveryJamesLavery GBBeta, University ✭✭✭✭

    @MichaelRidland I'm having trouble adding the 'Close' Toolbar button. This presumably has to go on the newly created tabbedNavigation.

    How do I bind this correctly so that I can call the appropriate command on (presumably) one or both of the child PageModels, to pop back?

  • JimTyminskiJimTyminski USUniversity ✭✭

    @MichaelRidland - I just switched from MvvmLight to FreshMvvm. First of all, great job! Love FreshMvvm.

    BUT - I also need to push a tabbed navigation without being modal. I don't see why this is not available, and I don't see why it's not a recommended UX, it looks and work great; a tabbed interface with a back button is perfect.

    Can you add this feature? :smile:

  • JimTyminskiJimTyminski USUniversity ✭✭
    edited November 2016

    @MichaelRidland - just to clarify - this is what I want to be able to do. Can I do this with FreshMvvm?

    And here is my ContentPage:

    <?xml version="1.0" encoding="utf-8" ?>
    <TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
                xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                xmlns:local="clr-namespace:Ximon.Features.Comparables;assembly=Ximon"
                Title="Comparables"
                NavigationPage.BackButtonTitle=""
                x:Class="Ximon.Features.Comparables.ComparablesPage">
    
      <local:ComparablesSummaryPage />
      <local:ComparablesSoldPage />
      <local:ComparablesActivePage />
    
    </TabbedPage>
    
  • MichaelRidlandMichaelRidland AUInsider, University ✭✭✭

    @JimTyminski it's not a recommend UX by Apple and XF had a few issues with it last time I checked, maybe they are resolved now.

    Have you attempted to push to a page that is a TabbedPage?

  • JimTyminskiJimTyminski USUniversity ✭✭

    @MichaelRidland - Yes, but then the child pages do not get auto BindingContext's. So I manually have to set them and lose some FreshMvvm features (Init, etc.).

  • tclaytclay USMember ✭✭

    Jim,

    Try this:

    <?xml version="1.0" encoding="utf-8" ?>
    <TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    x:Class="BaleMovement.Pages.MasterSettingsPage"
    xmlns:pages="clr-namespace:BaleMovement.Pages"
    Title="Settings">
    <pages:DeviceSettingsPage BindingContext="{Binding DeviceSettings}" />
    <pages:DatabaseSettingsPage BindingContext="{Binding DatabaseSettings}" />
    <pages:NetworkSettingsPage BindingContext="{Binding NetworkSettings}" />
    </TabbedPage>

    With the MasterSettingsPageModel

    public class MasterSettingsPageModel : FreshBasePageModel
    {
    public DeviceSettingsPageModel DeviceSettings { get; }
    public DatabaseSettingsPageModel DatabaseSettings { get; }
    public NetworkSettingsPageModel NetworkSettings { get; }
    ``
    public MasterSettingsPageModel() : base()
    {
    this.DeviceSettings = FreshIOC.Container.Resolve<DeviceSettingsPageModel>();
    this.DatabaseSettings = FreshIOC.Container.Resolve<DatabaseSettingsPageModel>();
    this.NetworkSettings = FreshIOC.Container.Resolve<NetworkSettingsPageModel>();
    }
    }

  • tclaytclay USMember ✭✭

    Ok, my "solution" doesn't work. The CoreMethods property is not set correctly.

  • Is that possible now?
    FreshMvvm is so limited?

  • MichaelRidlandMichaelRidland AUInsider, University ✭✭✭

    @JimTyminski I think this is a good feature request. I'm going to add this feature into FreshMvvm.

  • prusspruss Member

    Any progress on this feature?

Sign In or Register to comment.