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. Image for the cookie policy date

SfTabView MVVM Items Binding

Hello

I am using Syncfusion.Xamarin.SfTabView v17.2.0.41.

Is it possible to Bind all the SfTabItems with MVVM? If so, could you please provide an example where the Items are set in the model?

I tried something, but it does not display anything. Any help would be greatly appreciated.

MyPage.xaml
<tabView:SfTabView Items="{Binding Items}"></tabView:SfTabView>


MyPageModel.cs
public TabItemCollection Items = new TabItemCollection();
...
var ti = new SfTabItem();

var view = new StackLayout();
view.Children.Add(new Label { Text = "hello" });

ti.Content = view;
ti.Title = "tab1";

Items.Add(ti);


Kind regards
Phil

3 Replies

MK Muneesh Kumar G Syncfusion Team August 21, 2019 01:39 AM

Hi Phil, 
 
Greetings from Syncfusion.  
 
We have analyzed your requirement and we have prepared a sample based on this. Please find the sample from the following location.  
 
 
Here we have bound the TabItemsCollection Items property and it works fine.  
 
Please let us know if you have any other queries.  
 
Regards,  
Muneesh Kumar G 
 



PH Phil August 26, 2019 06:41 AM

Hello

Thank you for your sample, it helped me to find where the problem was.
You're right, the control works as it should, there was some other code I used that caused the DropDownList to lose focus.

Kind regards


MK Muneesh Kumar G Syncfusion Team August 26, 2019 10:21 PM

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


Loader.
Live Chat Icon For mobile
Up arrow icon