Skip to main content

TabView.ItemsSource Property

Gets or sets a collection used to generate the Tab View’s tab items.

Namespace: DevExpress.XamarinForms.Navigation

Assembly: DevExpress.XamarinForms.Navigation.dll

NuGet Package: DevExpress.XamarinForms.Navigation

Declaration

public IEnumerable ItemsSource { get; set; }

Property Value

Type Description
IEnumerable

A collection used to generate the Tab View’s tab items.

Example

The following example demonstrates how to generate items for a TabView from a data source:

Note

Complete example is available on GitHub.

   <ContentPage
       xmlns="http://xamarin.com/schemas/2014/forms"
       xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
       xmlns:dxn="http://schemas.devexpress.com/xamarin/2014/forms/navigation"
       xmlns:viewmodels="clr-namespace:GettingStarted2.ViewModels"
       x:Class="GettingStarted2.Views.MainPage">
       <ContentPage.BindingContext>
           <viewmodels:MainViewModel/>
       </ContentPage.BindingContext>
       <dxn:TabView ItemsSource="{Binding VehiclesByMake}"
                    SelectedItemIndex="{Binding SelectedIndex, Mode=TwoWay}">
           <dxn:TabView.ItemHeaderTemplate>
               <DataTemplate>
                   <Label Text="{Binding GroupKey}"
                          HorizontalTextAlignment="Center"
                          VerticalTextAlignment="Center"/>
               </DataTemplate>
           </dxn:TabView.ItemHeaderTemplate>
           <dxn:TabView.ItemTemplate>
               <DataTemplate>
                   <ListView ItemsSource="{Binding Vehicles}">
                       <ListView.ItemTemplate>
                           <DataTemplate>
                               <TextCell Text="{Binding FullName}"/>
                           </DataTemplate>
                       </ListView.ItemTemplate>
                   </ListView>
               </DataTemplate>
           </dxn:TabView.ItemTemplate>
       </dxn:TabView>
   </ContentPage>

The table below lists properties the markup above utilizes:

Property

Description

TabView.ItemsSource

Gets or sets a collection used to generate the Tab View’s tab items.

TabView.ItemTemplate

Gets or sets the template the Tab View uses to generate tab items’ content from the ItemsSource.

TabView.ItemHeaderTemplate

Gets or sets the template the Tab View uses to generate tab items’ headers from the ItemsSource.

See Also