[XF] Navigating between Tabs #650

Open
dansiegel opened this Issue Jun 20, 2016 · 74 comments

Projects

None yet
@dansiegel
Contributor

When working with a Tabbed Page, and navigating between tabs there is currently no implementation that allows you to properly handle the navigation events as INavigationAware is only called by the INavigationService, not by native navigation, like in the event of tapping a different Tab.

As discussed we could possibly add a new interface and tie this in via a custom behavior.

@brianlagunas
Member
brianlagunas commented Jun 20, 2016 edited

I'm curious if we could create a new interface that the NavigationService can use to control the TabbedPage navigation behavior. Something like

public interface ITabbbedPageNavigationOptions
{
    bool UseTabbedBasedNavigation {get;}
}

Then the TabbedPage could implement the interface and switch tabs instead of calling PushModelAsync/PushAsync.

But... that would require calling the navigation action off of the TabbedPageViewModel itself, not a page within the TabbedPaged. SO how would that work?

@dansiegel
Contributor

I'm thinking an approach similar to the ViewModelLocator's AutoWireViewModel property might work particularly well so that we can easily attach an event handler to the TabbedPage CurrentPageChanged and PagesChanged events.

@brianlagunas
Member

The only issue I can think about with the behavior is preventing the INavAware from invoking multiple times; once when navigated to, then again when responding the the tab changed event.

@dansiegel
Contributor

I would say that you want to fire when you load the initially selected tab, and again any time you change tabs. You may have an OnNavigatedFrom/To that needs to be handled at least if we're sticking with the current INavAware. Certainly how to handle things may get tricky, but that's on the developer to handle in their implementation not so much on the framework.

@brianlagunas
Member

Maybe a new interface would be better as to not to cause confusion between a navigation operation and a tab switching operation. I'm curious if passing parameters between tab changes would be needed, and if so how we could solve that.

@dansiegel
Contributor

I can certainly think of a few times where you may want to react to a change on one tab and update other tabs. I suppose you could use events, but I think there's a better way.

@polepage

I solved this particular issue with a Behavior that can be associated with a TabPage. It listens to the page change event, and calls TabNaviagatedFrom and TabNavigatedTo from the inner page ViewModels that implement ITabNavigationAware (a lot like the INavigationAware that already exist). I use a NavigationParameters object to pass parameters from one tab to the other.

@brianlagunas
Member

@polepage would you mind sharing your approach?

@polepage

Navigated from prompt the last view model to set the data to give to the next, Navigated to gives that data to the newly selected page. I used a different interface so a Page can also be INavigationAware. The thing works with any MultiPage,l not just TabPage.

public interface IMultiPageNavigationAware
{
  void OnInternalNavigatedFrom(NavigationParameters navParams);
  void OnInternalNavigatedTo(NavigationParameters navParams);
}

public class MultipageNavigationBehavior : Xamarin.Behaviors.Behavior<MultiPage<Page>>
{
  private Page _lastSelectedPage;

  protected override void OnAttach()
  {
    AssociatedObject.CurrentPageChanged += CurrentPageChangedHandler;
  }

  protected override void OnDetach()
  {
    AssociatedObject.CurrentPageChanged -= CurrentPageChangedHandler;
  }

  private void CurrentPageChangedHandler(object sender, EventArgs e)
  {
    NavigationParameters navParams = new NavigationParameters();
    if (_lastSelectedPage != null)
    {
      IMultiPageNavigationAware lastPageAware = _lastSelectedPage.BindingContext as IMultiPageNavigationAware;
      if (lastPageAware != null)
      {
        lastPageAware.OnInternalNavigatedFrom(navParams);
      }

      IMultiPageNavigationAware newPageAware = AssociatedObject.CurrentPage.BindingContext as IMultiPageNavigationAware;
      if (newPageAware != null)
      {
        newPageAware.OnInternalNavigatedTo(navParams);
      }
    }

    _lastSelectedPage = AssociatedObject.CurrentPage;
  }
}
@polepage

I use Xamarin.Behavior.Behavior(T) instead of the built in Xamarin.Forms.Behavior(T) because I had issues with the Xamarin Forms one some times ago and I never checked if my issues were fixed.

@brianlagunas
Member

@polepage thanks for sharing

@dansiegel
Contributor

@polepage this is a great approach!
@brianlagunas I would say we should add something like the ViewModelLocator so we can simply add the property to the TabbedPage and it can attach the behavior. I can look into this more later tonight.

@dansiegel
Contributor

@brianlagunas any thoughts as to whether this behavior should:

  • Be added automagically by the NavigationService for CarouselPages and TabbedPages
  • Be a Bindable Property that adds the behavior similar to the ViewModelLocator
  • Force developers to explicitly add the behavior? (Keep in mind with the other two, a developer always has the ability to do this if they want)
<TabbedPage xmlns:b="clr-namespace:Prism.Behaviors;assembly=Prism.Forms"
            xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
            prism:ViewModelLocator.AutowireViewModel="True"
            prism:PrismBehaviors.AddMultiPageNavigation="True">
    <TabbedPage.Behaviors>
        <!-- Explicitly Added -->
        <b:MultiPageNavigationBehavior />
    </TabbedPage.Behaviors>
</TabbedPage>
@brianlagunas
Member

My gut has me leaning towards a behavior

@dansiegel
Contributor

Well it has to be a behavior. The question is how do you think that behavior should be added. Should it be automatically by the NavigationService, by a BindableProperty making it an opt-in feature or explicitly added like any other behavior?

@brianlagunas
Member

I am leaning towards explicitly

@toadzky
toadzky commented Aug 3, 2016

I would really like to see this, is there anything I can do to help?

@dansiegel
Contributor

@toadzky I have it all working. There are just some implementation details that have to be figured out. If this is holding you back I've created a Gist you can borrow from to get you through until it gets added. For now you'll need to add the behavior to your MultiPage (TabbedPage/CarouselPage).

That said any feedback people have on the expected behavior would be great. Specifically would the community prefer to have this behavior automatically added by the NavigationService or should it be on the Developer to add to each page? Or is there another way all together that people would like to see it work?

@toadzky
toadzky commented Aug 3, 2016

Personally, I would prefer it be added by default with a way to disable it. I think the more common use case is going to be that developers want it to have that behavior out of the box. In my case, the user selects an item from a list and it navigates to a TabbedPage where each page displays different data that has to be loaded. All of the pages need the parameters, but I can only give them to the first one.

I'll give the gist a try and let you know if any pain points jump out at me.

@msloan
msloan commented Aug 5, 2016

I very much agree with @toadzky, this is behavior that I was expecting so it seems like it should be the default.

@brianlagunas
Member

It can't be default because there is no easy way to remove it if it's not wanted. It will have to be an opt-in.

@dansiegel
Contributor

I would make two points here:

  1. If your VM does not implement the IMultiPageNavigationAware you shouldn't notice a difference.
  2. If someone prefers to use their own behavior or something... We can easily incorporate a bindable property that they can attach similar to the VML.AutoWire property. We could use either a nullable bool or just name it something like DisableBehaviorInjection.
@brianlagunas
Member

I am not a fan of adding a separate attached property to turn off a behavior. That is not a common or expected approach in XAML development.

@brianlagunas
Member

So after playing around a little bit, I do kind of like that it is done automatically :)

The dev experience is much nicer. We just have to think of a good way to opt-out. Any other ideas besides an attached property? Maybe an interface IMultiPageNavigationOptions just like we have for NavigationPage and MasterDetail? It follows the same pattern anyways.

@dansiegel
Contributor

If we were to do something like that, I would image we would want something that goes on the MultiPage (Tabbed/Carousel).

public interface IMultiPageNavigationOptions
{
    bool InjectNavigationBehavior { get; }
}

public class PageNavigationService
{
   async Task ProcessNavigationForTabbedPage( ... )
   {
       var options = currentPage as IMultiPageNavigationOptions;

       if( options == null || options.InjectNavigationBehavior )
           currentPage.Behaviors.Add( new MultiPageNavigationBehavior() );
   }
}
@sunefred
sunefred commented Sep 5, 2016 edited

Would it be possible to have more general interfaces IDeactivateAware and IActivateAware that could also be called when activating and deactivating views through calls to Region.Activate etc. I wouldn't call switching tabs a navigation per say, it is more a user interaction to activate and deactivate a views.

@toadzky
toadzky commented Sep 5, 2016

I disagree. It's definitely navigation, it's just sideways navigation
instead of up and down.

On Mon, Sep 5, 2016 at 9:52 AM Sune Frederiksen notifications@github.com
wrote:

Would it be possible to have more general interfaces IDeactivateAware and
IActivateAware that could also be called when manually activating and
deactivating views. I wouldn't call switching tabs a navigation per say, it
is more a user interaction to activate and deactivate a views.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#650 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACLkWiJqMuuaAcoC6XEsAifrkX3_xxPBks5qnDqigaJpZM4I6Iai
.

@brianlagunas
Member

I agree with @sunefred. This is not navigation. You are just in a tabbed control changing/selecting a different tab.

@sunefred
sunefred commented Sep 6, 2016 edited

@toadzky Let me elaborate a little bit then, and we will see if you agree with me.

There are a multitude of ways to activate and deactivate content in a TabControl.

  1. View injection
  2. View discovery
  3. Navigation
  4. Region.Activate/Deactivate
  5. Manual tab selection

All of these will already affect the Region.ActiveViews and if you implement the IActiveAware interface you will get notification when your tab is deactivated. To me it is odd that manual tab selection should get special treatment when it is just one of many methods to select the active tab. And by the way IActiveAware also works on ContentControl, ListBox etc.

I see a complication if you use navigation in parts of your application to switch tabs and if you use INavigationAware to confirm switching tabs. In that case it is counter intuitive that manually clicking a tab does not require the same confirmation. Is this the use case you want to cover?

@toadzky
toadzky commented Sep 6, 2016

So I'm using Prism in Xamarin.Forms, and it sounds like basically everything you just said applies to WPF. Unless you add swiping (which isn't enabled by default IIRC), the only way to change tabs in XF is to tap the tab header.

@brianlagunas if the tabs themselves aren't part of navigation, why are their names part of the navigation urls? they are part of navigation if you are building a deep link, but not for siblings. it's kind of a weird way to separate it IMO.

@dansiegel
Contributor

@sunefred There is a distinct difference between activation and navigation whether it is done programatically such as NavigationService.NavigateAsync( "MyTabbedPage/TabA" ) or by "Manual tab selection". Given your line of thinking INavigationAware shouldn't even exist because really a page is Activating/Deactivating when you Navigate To it or away From it.

Given an activation scenario you are saying that we have created SomePage and the corresponding ViewModel, now go do something without any context to what is going on in the app. A Navigation scenario differs because there may be context that we want to share without explicitly knowing where it is coming from.

Besides that the implementation of TabbedPage isn't comparable to a Tab Control that you may be familiar with on the web, where it is a child element of a page (such as the one you see when writing a comment on this thread). The TabbedPage is really closer to a Control Template that you are applying to a selection of Pages which presents a common view wrapper with a control on the bottom for abstracting the navigation between a specified set of pages.

@brianlagunas
Member

@toadzky Let's say you have a nav uri like this:

NavigatAsync("MyTabbedPage/NextPage")

The first argument would be the actual TabbedPage. The next argument represents the next page in the navigation request, which may or may not be a page representing a tab in the MyTabbedPage. If it is a tab, then it will select that tab and continue processing the navigation request. This becomes more important when the tab is a navigation page, and navigation must continue within a different navigation stack. If it is not, it will create an instance of the NextPage, add it to the navigaton stack, and continue processing the navigation request. Just to clarify, the tabs don't have to be part of the navigation URI.

There is a distinct difference between simply changing tab selection, and processing a complex navigation request.

@toadzky
toadzky commented Sep 7, 2016

That makes sense. I agree that it shouldn't trigger the normal INavigationAware methods, but changing the name of the interface to something more generic feels weird. There is a concept of activation, but there is also the concept of explicit navigation. I may want to do something different when a user explicitly changes tabs then when a view is injected/discovered, etc. Activated doesn't mean navigated.

@SplayConsulting

Hey Guys, I have just started with Prism and love it, well done Brian.
I have the same issue, I have a tabbed page with three content pages, it would be really great if the OnNavigatedTo or similar was available. I wish I had enough experience to contribute.

@brianlagunas
Member

So I am finally getting around to looking at this. First off, in WPF, responding to tab changes in a tab control is handled by using the IActiveAware interface, with no options for passing parameters between tabs. Essentially, you are responding to a tab that is becoming active. Couldn't we take the same approach and leverage the IActiveAware interface for this?

I am also curious how common it is to pass parameters between tabs of a TabbedPage? I have a hard time seeing the need for that. Thoughts?

@dansiegel
Contributor

If IActiveAware wasn't already a thing I would say that could be a good name. However I think a solution that provides a way to pass information in the way of NavigationParameters would be better.

Take the case where we navigate from PageA => PageB. Now say PageA is a search page that incorporates the lookup logic for the object we want to work with. When we navigate to PageB it only makes sense that PageB would know about our object. If PageB is a TabbedPage we have no way of telling its children what object we're working with unless we allow the parent to share its navigation parameters and have a way to pass it to the children and/or their view models.

@toadzky
toadzky commented Oct 1, 2016

@brianlagunas in my particular case, i have multiple tabs that load data independently, but what data they need to load is passed in as navigation parameters from the previous page. since i can't pass navigation parameters to each of the pages in the NavigateAsync call, i pass all the parameters to the first page and then forward them to other pages via IMultiPageNavigationAware. it's not the most elegant solution, i admit, but it's the best one i was able to figure out.

@brianlagunas
Member

@toadzky Well can't you just propagate those parameters in the TabbedPage to it's children? Implement INavigationAware on the TabbedPage, capture the parameters and then loop through the children and set a property on their ViewModels that is used to load the data?

I'm just trying to think if passing parameters from tab to tab is a common task, or just an exception.

@toadzky
toadzky commented Oct 1, 2016

Loop through what children? Where do I get references to the view models
inside a multipage container?

On Fri, Sep 30, 2016, 23:07 Brian Lagunas notifications@github.com wrote:

@toadzky https://github.com/toadzky Well can't you just propagate those
parameters in the TabbedPage to it's children? Implement INavigationAware
on the TabbedPage, capture the parameters and then loop through the
children and set a property on their ViewModels that is used to load the
data?

I'm just trying to think if passing parameters from tab to tab is a common
task, or just an exception.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#650 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACLkWrAk0b8O4sbu_9vzbHiRqCLYALlnks5qveqogaJpZM4I6Iai
.

@brianlagunas
Member

@dansiegel Well would it be more useful if the TabbedPageNavigationOptions had a property called PropagateParametersToChildren which if set, the navigation service would send the parameters to all child pages via OnNavigatedTo? It would be more of a one time thing, and wouldn't support passing params from tab to tab on selection changed

@brianlagunas
Member
brianlagunas commented Oct 1, 2016 edited

@toadzky You get the VMs from the child Page's BindingContext. Cast them as a common interface and set the property accordingly.

@toadzky
toadzky commented Oct 1, 2016

I'm still not following how I would have that information in the view model
of tabbed page.

To be honest, I actually like the auto propagate flag. It's the behavior I
expected when I started using Prism and wasn't specifying a specific tab in
my navigation url. That should work nicely. Just have an interface (it
could be INavigationAware) that the sub-page implements to receive them
and set the flag.

On Fri, Sep 30, 2016, 23:11 Brian Lagunas notifications@github.com wrote:

You get the VMs from the child Page's BindingContext. Cast them as a
common interface and set the property accordingly.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#650 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACLkWmPzfTMbd1sYrw1hTQGZx02y6rKDks5qveuGgaJpZM4I6Iai
.

@brianlagunas
Member

If we did add a property to an interface to control this, should it be an enum to control the behavior? Assuming the property was called ForwardNavigationParameters

With the following options:

  • ActivePage
  • AllPages
@dansiegel
Contributor

@brianlagunas while having an option for the NavigationService to pass the parameters to the TabbedPages children would be nice there are cases where I could see it being buggy. For instance I have TabbedPages that dynamically set which children should be added based on values either on my object or parameters passed to the TabbedPage.

Also I can think of some scenarios where you may change a value on the object you're working with, and rather than persisting it to a database and then reloading it on the next tab you may prefer to simply pass the updated object.

@brianlagunas
Member

Okay, so we may have two issues here:

  1. Need a way to optionally pass parameters to the TabbedPaged children (one or all).
  2. Need a way to pass parameters from tab to tab upon a new tab selection.

So for issue 1 we can utilize a TabbedPageNavigationOptions interface with a property to forward the parameters to the children via the INavigationAware interface. This will be opt-in, and may cause a duplicate call to OnNavigatedTo if they have the property set and are explicitly navigating to a tab; for example NavigateAsync("MyTabbedPage/TabA")

If we implement issue 1, we may be creating a source of bugs and confusion.

For issue 2, we need a behavior that will

  • Call a method from the tab being unselected to signify we are changing tabs
  • Provide a method that can request or gather parameters that will be used in the newly selected tab (maybe this method is the same method in the first bullet)
  • Call a method on the newly selected tab and provide the parameters that were provided from the previously selected tab.

If we properly implement issue 2, we may not need to implement issue 1 as issue 2 would essentially provide a consistent way of getting parameters from tab to tab.

Does this sound right?

@toadzky
toadzky commented Oct 3, 2016

it sounds about right to me. personally, i tend to lean more toward issue 1, since i would rather the parent know what all children need than for siblings to have know what each other need. but the IMultipageNavigationAware behavior that was gisted earlier has been working well enough for me to just forward everything that was passed in with whatever additions that page makes.

@brianlagunas brianlagunas added this to the Prism for XF 6.3 milestone Oct 25, 2016
@scorpio2000

Hello,

I am new to Prism and Xamarin forms. I am trying to implement the functionality to change the active page in a tabbed page in Xamarin Forms. Is there currently any way to support this?

@brianlagunas
Member

@scorpio2000 this is probably not something Prism will do. Changing tabs from within a tab is not an orthodox navigation function in XF. You can create a custom behavior to achieve this.

@beylkhanovdamir
beylkhanovdamir commented Dec 20, 2016 edited

@brianlagunas do you mean that we need to add behavior for event like Appearing for Page and then call navigation method in Prism for transfer to required page

`<TabbedPage.Children>

<NavigationPage Title="Home" > 
  <x:Arguments>
    <views:MainPage>
    </views:MainPage>
  </x:Arguments>
</NavigationPage>
<NavigationPage Title="Catalog">
  <x:Arguments>
    <views:CatalogPage>
    </views:CatalogPage>
  </x:Arguments>
</NavigationPage>

</TabbedPage.Children>
`

How do I handle tap events during tab click?

could you provide a short sample for this case, pls

@polepage your way is working for you?

@nuitsjp
Contributor
nuitsjp commented Dec 26, 2016

Hello,
I have one suggestion.

This is when the contents of the tab are NavigationPage.
In many cases, we would like the IMultiPageNavigationAware event in CurrentPage of NavigationPage.

Now the code looks like this:

public class MultiPageNavigationBehavior<T> : BehaviorBase<MultiPage<T>> where T : Page
{
    ...
    protected async Task HandleNavigationToPage( Page page, bool navigatedTo, NavigationParameters parameters )
    {
        await NavigationAwareHandler( page, parameters, navigatedTo );
        await NavigationAwareHandler( page?.BindingContext, parameters, navigatedTo );
    }

Here, I want to change this way.

protected async Task HandleNavigationToPage( Page page, bool navigatedTo, NavigationParameters parameters )
{
    await NavigationAwareHandler( page, parameters, navigatedTo );
    await NavigationAwareHandler( page?.BindingContext, parameters, navigatedTo );

    var navigationPage = page as NavigationPage;
    if (navigationPage != null)
    {
        await NavigationAwareHandler(navigationPage.CurrentPage, parameters, navigatedTo);
        await NavigationAwareHandler(navigationPage.CurrentPage?.BindingContext, parameters, navigatedTo);
    }
}

Let me hear your opinion.

@brianlagunas
Member

@nuitsjp Good thinking. It is very common the have a NavigationPage within a TabbedPage. If we are dealing with a navigationPage, should we call the methods on the NavigationPage AND the CurrentPage, or just the CurrentPage?

protected async Task HandleNavigationToPage( Page page, bool navigatedTo, NavigationParameters parameters )
{
    var navigationPage = page as NavigationPage;
    if (navigationPage != null)
    {
        await NavigationAwareHandler(navigationPage.CurrentPage, parameters, navigatedTo);
        await NavigationAwareHandler(navigationPage.CurrentPage?.BindingContext, parameters, navigatedTo);
    }
    else
    {
        await NavigationAwareHandler( page, parameters, navigatedTo );
        await NavigationAwareHandler( page?.BindingContext, parameters, navigatedTo );
    }
}```
@brianlagunas
Member

As everyone can see, I am back from vacation and ready to start implementing more features. I plan on releasing another preview soon after we get the EventToCommand, and maybe some other smaller things fixed. So look for this feature to be implemented in preview 3.

@nuitsjp
Contributor
nuitsjp commented Jan 5, 2017 edited

@brianlagunas

  • It might be necessary for Customized NavigationPage.
  • No adverse effects on my way (Except for a few performance)

It is unnecessary in the default NavigationPage, but I think that it is better to apply it to both.

@beylkhanovdamir

@brianlagunas waiting v. 6.3 👍

@pasha-o
pasha-o commented Jan 10, 2017

hi @brianlagunas
do you have an update on when to release this feature? I saw some documentation but not sure when this is going to be released? also is there any example on how to use it?

@brianlagunas
Member

this hasn't been implemented yet. This will be in the next 6.3 release which currently doesn't have a release date.

@pasha-o
pasha-o commented Jan 10, 2017

ok thanks for the update - i think in the mean time i should create my own behavior according to what's discussed here.

@pasha-o
pasha-o commented Jan 19, 2017

hi Guys,
I implemented the approach of IMultiPageNavigationAware and attached behavior and internal navigation to and from is being raised whenever i change tabs - one question I I have is how to pass navigation parameters between tabs once i click on a tab - since i am not making a direct call to navigate in the VM in I can't pass any parameters from code behind.

any help is appreciated

@brianlagunas
Member

I haven't really looked at the code, but you could try adding them to the parameters collection in the OnNavigatedFrom. Then they should be passed to the OnNaviatedTo of the target page. Not sure though, as I didn't write the code.

@dansiegel
Contributor

@pasha-o the Gist I created and the code in the PR are designed to give you the same experience as INavigationAware. As previously mentioned you would simply add parameters to the NavigationParameters collection in OnInternalNavigatedFrom and they are automatically passed to OnInternalNavigatedTo the same as INavigationAware. Both OnInternalNavigatedFrom & OnInternalNavigatedTo are called anytime the user taps on a different tab.

@lhughey
lhughey commented Jan 19, 2017 edited

Is anyone having problems getting xaml bindings to work when using IActiveAware on children tabs within a tabbedPage?

I have a static ObservableCollection defined in the app.cs class that is being populated after the child page is created. The list view is not populated with the observable collection when I browse the page when the page is accessed via a tab bar click. Note that the OnActive event is firing.

However, the observablecollection correctly binds to the list view when I browse the page via a button click which triggers the INavigationAware interface.

It's like the INavigation call is making a Trigger an binding event, but calls that use the IActiveAware interface calls are not.

I apologize for grammar mistakes. I'm typing from a phone.

@brianlagunas
Member
brianlagunas commented Jan 19, 2017 edited

I have a static ObservableCollection defined in the app.cs class

This scares me. I would not recommend that.

As of now, INavigationAware does not fire when switching tabs via clicking on tab headers. This is why this issue has been submitted. We need a solution to this, and there is one approach available in this thread, and PR #712 has been submitted which also need to be reviewed. As of now, this has not been implemented.

@lhughey
lhughey commented Jan 19, 2017

I wrote INavigationAware when I meant IActiveAware in the first sentence (my bad).

The binding does not trigger binding on an tab press when IActiveAware is used. This is on my on my mac laptop running against the iOS simulator. It works just fine on Android using my PC. I'll sync the code between the machines when I get home and verify.

@brianlagunas
Member

IActiveAware does nothing special in regards to binding, nor does INavigationAware. The IActiveAware.IsActive property is set after a new Tab selection has been made.

@pasha-o
pasha-o commented Jan 20, 2017

Thanks for the input @dansiegel and @brianlagunas

it worked .

@beylkhanovdamir

@brianlagunas

We need a solution to this, and there is one approach available in this thread, and PR #712 has been submitted which also need to be reviewed.

it is will be implemented in 6.3 release after your successful review or not?

@beylkhanovdamir
beylkhanovdamir commented Jan 20, 2017 edited

currently I'm using an approach for switching between tabs based on my custom behavior which is inherited from BehaviorBase<VisualElement> and this behavior was subscribed to TabbedPage on CurrentPageChangedevent.

But this way is not good, cuz, when I want to open a Tab page via NavigationService programmatically, navigation in app is activated twice (1 call by request via NavigationService, 2 call by my custom behavior which is subscribed on CurrentPageChangedevent)

@riandesign

What would be the solution for this issue?
I need to retrieve data when user access a tab page.

I followed the solution below, but it doesn't work for me:
https://github.com/qmatteoq/XamarinForms-Prism/tree/master/DeepNavigation

@beylkhanovdamir

@riandesign

I followed the solution below, but it doesn't work for me:
https://github.com/qmatteoq/XamarinForms-Prism/tree/master/DeepNavigation

You can found in post by Matteo that him solution is working but it hasn’t been included yet in the current Prism version

@riandesign

@beylkhanovdamir

You can found in post by Matteo that him solution is working but it hasn’t been included yet in the current Prism version

But what would be a solution for now?

@beylkhanovdamir
beylkhanovdamir commented Jan 20, 2017 edited

@riandesign

I think @brianlagunas must give answer on this question =)
For now I'm temporarily use my custom behavior for it

@brianlagunas
Member

The plan is to have a solution to tab switching in 6.3 RTM.

@beylkhanovdamir

@brianlagunas
do you have a planned date for 6.3 RTM?

@brianlagunas
Member

No. I do not have a date. I work on Prism in my free time in-between my job, family, and other community events. That's why I push previews throughout the process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment