Skip to main content

TabPage.ItemTemplate Property

Gets or sets the template the TabPage uses to generate tab item content from the ItemsSource.

Namespace: DevExpress.XamarinForms.Navigation

Assembly: DevExpress.XamarinForms.Navigation.dll

NuGet Package: DevExpress.XamarinForms.Navigation

Declaration

public DataTemplate ItemTemplate { get; set; }

Property Value

Type Description
DataTemplate

The template the TabPage uses to generate tab item content from the ItemsSource.

Example

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

Note

The topic Populate Tab Items from a Data Source contains the complete example.

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

The table below lists properties the markup above utilizes:

Property

Description

TabPage.ItemsSource

Gets or sets the collection used to generate the TabPage’s tab items.

TabPage.ItemTemplate

Gets or sets the template the TabPage uses to generate tab item content from the ItemsSource.

TabPage.ItemHeaderTemplate

Gets or sets the template the TabPage uses to generate tab item headers from the ItemsSource.

See Also