This is a migrated thread and some comments may be shown as answers.

Dynamic Tab Page

1 Answer 83 Views
TabView
This is a migrated thread and some comments may be shown as answers.
Software
Top achievements
Rank 1
Software asked on 08 Jan 2019, 08:28 PM

Hi we want to create dynamic tab page using telerik radtabview in our app but unfortunately we could not find any option in telerik for dynamic tab page. So now we are using xamarin forms tabbed page but its complicated. It would be great if there is any solution for that problem by using radtabview. I am sharing my code below:

<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"
             xmlns:telerikDataControls="clr-namespace:Telerik.XamarinForms.DataControls;assembly=Telerik.XamarinForms.DataControls"
             xmlns:telerikListView="clr-namespace:Telerik.XamarinForms.DataControls.ListView;assembly=Telerik.XamarinForms.DataControls"
             xmlns:telerikPrimitives="clr-namespace:Telerik.XamarinForms.Primitives;assembly=Telerik.XamarinForms.Primitives"
             x:Class="Ls.Learn.LearnPage"
             ItemsSource="{Binding VolumeCategoryList}"
             x:Name="lTabbedPage"
             BarTextColor="White"
             BarBackgroundColor="#006b91">
<TabbedPage.ItemTemplate>
        <DataTemplate>
            <ContentPage Title="{Binding Label}">
                <telerikDataControls:RadListView  ItemsSource="{Binding Volumes}" x:Name="listView" ItemTapped="Results_ItemTapped">
                    <telerikDataControls:RadListView.ItemTemplate>
                        <DataTemplate>
                            <telerikListView:ListViewTemplateCell>
                                <telerikListView:ListViewTemplateCell.View>
                                    <Grid Padding="12">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="3*"></ColumnDefinition>
                                            <ColumnDefinition Width="7*"></ColumnDefinition>
                                        </Grid.ColumnDefinitions>
                                        <ffimageloading:CachedImage Grid.Row="0" Grid.Column="0" Aspect="AspectFill"
                                      DownsampleToViewSize="true" Source="{Binding ImageUrl}">
                                        </ffimageloading:CachedImage>
                                        <StackLayout Grid.Column="1" VerticalOptions="StartAndExpand">
                                            <Label class="volume-name"  Text="{Binding VolumeSubject}" LineBreakMode="WordWrap"></Label>
                                        </StackLayout>
                                    </Grid>
                                </telerikListView:ListViewTemplateCell.View>
                            </telerikListView:ListViewTemplateCell>
                        </DataTemplate>
                    </telerikDataControls:RadListView.ItemTemplate>
                    <telerikDataControls:RadListView.LayoutDefinition>
                        <telerikListView:ListViewLinearLayout  />
                    </telerikDataControls:RadListView.LayoutDefinition>
                </telerikDataControls:RadListView>
            </ContentPage>
        </DataTemplate>
    </TabbedPage.ItemTemplate>
</TabbedPage>

1 Answer, 1 is accepted

Sort by
0
Lance | Manager Technical Support
Telerik team
answered on 08 Jan 2019, 10:37 PM
Hello Tahmina,

This is not an officially supported scenario, the RadTabView isn't an items control that renders DataTemplate definitions.  Instead, you define the instantiated View objects in the Items's TabViewItem.Content property.

That being said, you can devise a way to create an items source, take a look at the SDK Example's ItemsSourceExample  (remember that keep in mind that you do not set a DataTemplate, every View is instantiated by you and your model will need to account for that).

Regards,
Lance | Tech Support Engineer, Sr.
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
TabView
Asked by
Software
Top achievements
Rank 1
Answers by
Lance | Manager Technical Support
Telerik team
Share this question
or