Add Total to a ListView Footer

rxamarxama USMember ✭✭

Hello,

In this example how can I add a Total in footer?

I have my ItemSource StatusMachines

but in Footer TotalAmount is a summatory that I made in my ViewModel From Amount, it is outside of StatusMachines.

TotalAmount in footer appears as a blank Cell, I think because is not a part of StatusMachines

What can I do?

Thank you!

<Grid Grid.Row="1" Padding="0,0,0,0" RowSpacing="0">
          <ListView
              ItemsSource="{Binding StatusMachines}"
              SelectedItem="{Binding SelectedStatusName, Mode=TwoWay}"
              BackgroundColor="Transparent"
              SeparatorVisibility="None">

    <ListView.Footer> 
          <Label Text="{Binding TotalAmount}" />
    </ListView.Footer>


            <ListView.ItemTemplate>
              <DataTemplate>
                <ViewCell>
                  <Grid ColumnSpacing="1" RowSpacing="0" BackgroundColor="#7C7C7C" >
                    <Grid.ColumnDefinitions>
                      <ColumnDefinition Width="*" />
                      <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <Image Grid.Column="0" Source="Varios/colorceldas-gris-osc.jpeg" Aspect="Fill"/>
                    <Label Grid.Column="0"
                      Text="{Binding StatusName}"/>

                    <Image Grid.Column="1" Source="Varios/colorceldas-gris-cla.jpeg" Aspect="Fill"/>
                    <Label Grid.Column="1"
                      Text="{Binding Amount}"/>

                  </Grid>
                </ViewCell>
              </DataTemplate>
            </ListView.ItemTemplate>
          </ListView>
        </Grid>

Best Answer

Answers

Sign In or Register to comment.