José
José

Reputation: 165

listview organization xamarin forms

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>

Upvotes: 0

Views: 138

Answers (1)

SushiHangover
SushiHangover

Reputation: 74094

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>

Upvotes: 1

Related Questions