Я пытаюсь создать многострочное на ListView.Header
и ListView.ItemTemplate
, но я не нашел ни одного примера.
Как я могу это сделать?
Нужно
HEADER
____________________________________
| col1 | col2 | col3 | col4 |
------------------------------------
| col5 | col6 | col7 | col8 | col9 |
------------------------------------
ITEMTEMPLATE like header
Пытаться
<StackLayout HorizontalOptions="FillAndExpand">
<ListView x:Name="ListGraosRomaneios"
SeparatorVisibility="Default">
<ListView.Header>
<Grid HorizontalOptions="FillAndExpand" BackgroundColor="#335D3B">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition><!--row 1-->
<RowDefinition></RowDefinition><!--row 2-->
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition><!--col 1-->
<ColumnDefinition Width="*"></ColumnDefinition><!--col 2-->
<ColumnDefinition Width="*"></ColumnDefinition><!--col 3-->
<ColumnDefinition Width="*"></ColumnDefinition><!--col 4-->
<ColumnDefinition Width="*"></ColumnDefinition><!--col 5-->
<ColumnDefinition Width="*"></ColumnDefinition><!--col 6-->
</Grid.ColumnDefinitions>
<!--margin (left, top, right, bottom)-->
<!--row 1-->
<Label Grid.Row="0" Grid.Column="0" Margin="2, 2, 0, 2" FontAttributes="Bold" Text="ROMANEIO" TextColor="White" HorizontalOptions="StartAndExpand"></Label>
<Label Grid.Row="0" Grid.Column="1" Margin="0, 2, 0, 2" FontAttributes="Bold" Text="DATA" TextColor="White" HorizontalOptions="CenterAndExpand"></Label>
<Label Grid.Row="0" Grid.Column="2" Margin="0, 2, 0, 2" FontAttributes="Bold" Text="L/KG" TextColor="White" HorizontalOptions="CenterAndExpand"></Label>
<Label Grid.Row="0" Grid.Column="3" Margin="0, 2, 0, 2" FontAttributes="Bold" Text="SACAS" TextColor="White" HorizontalOptions="EndAndExpand"></Label>
<!--row 2 -->
<Label Grid.Row="1" Grid.Column="0" Margin="2, 2, 0, 2" FontAttributes="Bold" Text="%UMI" TextColor="White" HorizontalOptions="Center"></Label>
<Label Grid.Row="1" Grid.Column="1" Margin="0, 2, 0, 2" FontAttributes="Bold" Text="%IMP" TextColor="White" HorizontalOptions="Center"></Label>
<Label Grid.Row="1" Grid.Column="2" Margin="0, 2, 0, 2" FontAttributes="Bold" Text="%AVA" TextColor="White" HorizontalOptions="Center"></Label>
<Label Grid.Row="1" Grid.Column="3" Margin="0, 2, 0, 2" FontAttributes="Bold" Text="%ESV" TextColor="White" HorizontalOptions="Center"></Label>
<Label Grid.Row="1" Grid.Column="4" Margin="0, 2, 0, 2" FontAttributes="Bold" Text="%OUT" TextColor="White" HorizontalOptions="Center"></Label>
<Label Grid.Row="1" Grid.Column="5" Margin="0, 2, 0, 2" FontAttributes="Bold" Text="%QBR" TextColor="White" HorizontalOptions="Center"></Label>
</Grid>
</ListView.Header>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid HorizontalOptions="FillAndExpand">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition><!--row 1-->
<RowDefinition></RowDefinition><!--row 2-->
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition><!--col 1-->
<ColumnDefinition Width="*"></ColumnDefinition><!--col 2-->
<ColumnDefinition Width="*"></ColumnDefinition><!--col 3-->
<ColumnDefinition Width="*"></ColumnDefinition><!--col 4-->
<ColumnDefinition Width="*"></ColumnDefinition><!--col 5-->
<ColumnDefinition Width="*"></ColumnDefinition><!--col 6-->
</Grid.ColumnDefinitions>
<!--row 1-->
<Label Grid.Row="0" Grid.Column="0" Text="{Binding app_num_romaneio}" HorizontalOptions="Start"></Label>
<Label Grid.Row="0" Grid.Column="1" Text="{Binding app_data, StringFormat='{}{0:dd/MM/yyyy}'}" HorizontalOptions="Start"></Label>
<Label Grid.Row="0" Grid.Column="2" Text="{Binding app_qtde_kg_liquido, StringFormat=' {0:###,###.##}' }" HorizontalOptions="Start"></Label>
<Label Grid.Row="0" Grid.Column="3" Text="{Binding app_quantidade_saca, StringFormat=' {0:###,###.##}' }" HorizontalOptions="EndAndExpand"></Label>
<!--row 2-->
<Label Grid.Row="1" Grid.Column="0" Text="{Binding app_num_romaneio}" HorizontalOptions="Start"></Label>
<Label Grid.Row="1" Grid.Column="1" Text="{Binding app_percfator_umidade, StringFormat=' {0:###,###.##}' }" HorizontalOptions="Start"></Label>
<Label Grid.Row="1" Grid.Column="2" Text="{Binding app_percfator_impureza, StringFormat=' {0:###,###.##}' }" HorizontalOptions="Start"></Label>
<Label Grid.Row="1" Grid.Column="3" Text="{Binding app_percfator_avariados, StringFormat=' {0:###,###.##}' }" HorizontalOptions="Start"></Label>
<Label Grid.Row="1" Grid.Column="4" Text="{Binding app_percfator_esverdeados, StringFormat=' {0:###,###.##}' }" HorizontalOptions="Start"></Label>
<Label Grid.Row="1" Grid.Column="5" Text="{Binding app_percfator_outros, StringFormat=' {0:###,###.##}' }" HorizontalOptions="Start"></Label>
<Label Grid.Row="1" Grid.Column="6" Text="{Binding app_percfator_partidos_quebrados, StringFormat=' {0:###,###.##}' }" HorizontalOptions="Start"></Label>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout><!--/principal>-->