0
votes

I have the following order in my listview, whenever the application is open and the footer is at the end, being that he was to remain in the middle of the items

        <ListView.Header>
            //First item
        </ListView.Header>

        <ListView.Footer>
             //second item
        </ListView.Footer>

        <ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>
             //third item
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>

</ContentPage.Content>
1
A Footer is well, a footer and will be at the end of your listview, do want something after the Header (i.e. a sub-header) or do you mean a UI element in the middle of all the list view items?SushiHangover
I guess you're doing it wrong, buddy ... The Header and Footer sections are designed to wrap the content of the list at the top and bottom of it's content respectively ... Is there any practical scenario that we can help?Diego Rafael Souza
and this even a subheader that I want @SushiHangoverJosé

1 Answers

1
votes

a subheader that I want

You can create a custom header for your ListView that contains whatever elements you need:

<ListView.Header>
    <StackLayout Orientation="Horizontal">
        <Label Text="Header" TextColor="Green" />
        <Label Text="SubHeader" TextColor="Red" />
    </StackLayout>
</ListView.Header>

If you want a "sticky" header that does not scroll with the list, you can place your elements above the ListView:

<StackLayout Orientation="Vertical" >
    <StackLayout Orientation="Vertical">
        <Label Text="Header" TextColor="Green" />
        <Label Text="SubHeader" TextColor="Red" />
    </StackLayout>
    <ListView>
        ~~~~~
    </ListView>
</StackLayout>