Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

C# Xamarin Forms transform ContentPage to TabbedPage

$
0
0

Hello,

I have a Content page with a Listview binding to an object.
Is there a way to turn this into a TabbedPage?
The goal is to be able to Create multiple tabs and then bind its context.
This is my xml of my content page.
contentPage---


<ListView.GroupHeaderTemplate >




        <ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>
                    <ViewCell.View>
                        <Grid Padding="5" BackgroundColor="GhostWhite">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="50" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Label Text="{Binding Time}" TextColor="Black" Grid.Column="0"></Label>
                            <Label Text="{Binding TeamOne}" Grid.Column="1" TextColor="Black" HorizontalTextAlignment="End" HorizontalOptions="CenterAndExpand" Margin="0,0,170,0"></Label>
                            <Label Text="{Binding ScoreTeamOne}" Grid.Column="1" TextColor="White" HorizontalOptions="CenterAndExpand" HorizontalTextAlignment="Center" Margin="0,0,50,0" WidthRequest="20" BackgroundColor="Gray"></Label>
                            <Label Text="{Binding ScoreTeamTwo}" Grid.Column="1" TextColor="White" HorizontalOptions="CenterAndExpand" HorizontalTextAlignment="Center" Margin="0,0,5,0" WidthRequest="20" BackgroundColor="Gray"></Label>
                            <Label Text="{Binding TeamTwo}" Grid.Column="1" TextColor="Black" HorizontalTextAlignment="Start" HorizontalOptions="CenterAndExpand" Margin="110,0,0,0"></Label>
                            <Label Text="{Binding Tip}" Grid.Column="1" HorizontalOptions="EndAndExpand" WidthRequest="50" HorizontalTextAlignment="Center" TextColor="White" BackgroundColor="{Binding TipBGColor}"></Label>
                        </Grid>
                    </ViewCell.View>
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>
    <StackLayout Orientation="Horizontal" Padding="5" BackgroundColor="Black">
        <Button x:Name="goProButton" Text="Try PRO" TextColor="Black" HorizontalOptions="FillAndExpand" Clicked="Button_Clicked" BackgroundColor="White"/>
    </StackLayout>
    <!--<ads:AdRewardedControl BackgroundColor="Red" Grid.Row="1"/>-->
</StackLayout>

--contentPage.
I am currently simply binding the the listview on lunch.
listView.ItemsSource = sortedItems;
How can i turn this into a tab to be able to create multiple tabs with same or different context?

P.S. I have attached a code.txt file. Coding quotes don't work very well on posts and code is not visible...


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>