We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to get a sftabview and sflistview information at the same time?

Thread ID:

Created:

Updated:

Platform:

Replies:

145018 Jun 1,2019 10:11 PM UTC Jun 7,2019 05:42 AM UTC Xamarin.Forms 6
loading
Tags: SfTabView
Vially Israel
Asked On June 1, 2019 10:11 PM UTC

Hi in my XAML I have a SfListView and a SfTabView and at a moment I have the follow code:




EventName="TabItemTapped" Command="{ Binding SelectionChangedCommand }"
CommandParameter="{ Binding Source={ x:Reference lvAgreements }}" />


...

At CommandParameter I want have something like that CommandParameter="{ Binding Source={ x:Reference lvAgreements, tbvMenuBottom }}" />

I need to get sfListView and the sfTabView information in my ViewModel.

How can I get it?

Muneesh Kumar G [Syncfusion]
Replied On June 4, 2019 12:02 PM UTC

Hi Vially, 
 
Greetings from Syncfusion. 
 
We have validated your query and created a sample to achieve your requirement. Please find the sample from below link. 
 
 
In this sample, we have done the following things, 
 
1. Added TabItemTapped command to the SfTabview using Event to command behavior. 
 
2. Get the SfTabItem as the arguments from TapItemTapped as like below code snippet 
 

        void OnTapped(Object obj)
        {
            model.Arguments = (obj as Syncfusion.XForms.TabView.TabItemTappedEventArgs)?.TabItem;
            model.TabHeaderPosition = ((obj as Syncfusion.XForms.TabView.TabItemTappedEventArgs)?.TabItem.Parent as SfTabView).TabHeaderPosition;
        } 
 
Now, you can get the SfListView and information from the tab item content as like below code snippet 
 
 var content = (obj as Syncfusion.XForms.TabView.TabItemTappedEventArgs)?.TabItem.Content; 
 
We request you to try our sample and If your requirement is different from this, could you please share more information about this. 
 
This will be helpful for us to provide you a good solution and improve us to serve you better. 
  
Regards, 
Muneesh Kumar G. 


Vially Israel
Replied On June 4, 2019 09:30 PM UTC

Hi, Muneesh.

You helped me a little, but was because I forgot to explain one more thing, sorry.

I want when I click in the menutab button do create a PushAsync Page.

If I use

< tabview:SfTabView.Behaviors >
                    < helper:EventToCommandBehavior EventName="TabItemTapped" Command="{ Binding TappedCommand }" CommandParameter="{ Binding Arguments }" / >
               

I can create the page when click in the first button. But if I click in another button I get an error after my PushAsync in my ViewModel. I guess is because the tabview wants to change the focus on the button.

So, what event I can use in this case? TabItemTapped doens't work in this case.


Vially Israel
Replied On June 5, 2019 07:01 PM UTC

I discovered the error is: Exception thrown: 'System.NullReferenceException' in Syncfusion.SfTabView.XForms.UWP.dll

The error happens in UWP project. In the Android it doesn't.

Muneesh Kumar G [Syncfusion]
Replied On June 6, 2019 01:46 PM UTC

Hi Vially,  
 
We have validated the reported issue in SfTabView. And we would like to inform you that you have navigated to next page in OnTapped method, this causes the SfTabView to be disposed and hence the crash occurred.  
 
We have other processes running like animation after the selection is changed. You can resolve this problem by using Task.Delay before the navigation as per the below code snippet.  
 
Code snippet 
 
await Task.Delay(1);
await this.Navigation.PushModalAsync(new SecondPage());
 
 
  
Please find the sample from below link 
 
Please let us know if you have any other queries.  
  
Regards,  
Muneesh Kumar G.  


Vially Israel
Replied On June 6, 2019 06:47 PM UTC

Hi, Muneesh!

Thanks! It's work!

Muneesh Kumar G [Syncfusion]
Replied On June 7, 2019 05:42 AM UTC

Hi Vially, 
 
Thanks for the update. 
  
We are glad to know that the given solution works. Please let us know if you need any further assistance. 
 
Regards, 
Muneesh Kumar G. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon