3
I haven’t been able to organize my layout in my Listview, it gets disorganized, I’ve tried several ways but so far nothing, I would like to have tips/help. I wish I could have the Código
at first, Valor
in the middle and Hora lance
at the end. No Genymotion:
On an Android device:
Note: I am avoiding the StackLayout
because it has understood from some sources that it can hinder the end performance of the user.
Follows XAML code:
<!-- Listagem de Lances -->
<StackLayout>
<ListView x:Name="lstLance"
ItemTapped="Lance_OnItemTapped"
BackgroundColor="LightGray"
HasUnevenRows="True">
<!-- HasUnevenRows = Serve para fazer com que o conteúdo digitado não seja cortado -->
<ListView.ItemTemplate>
<!-- DataTemplate = exibe dados de uma coleção de objetos em um ListView -->
<DataTemplate>
<ViewCell>
<Grid Margin="2">
<!-- Colunas -->
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!-- Linhas -->
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="1"/>
</Grid.RowDefinitions>
<!-- Código -->
<Label Grid.Row="0"
Grid.Column="0"
Text="Código:"
FontSize="Small"
Margin="0"/>
<Label Grid.Row="0"
Grid.Column="1"
Text="{Binding ID_LANCE}"
FontSize="Small"
TextColor="Black"
HorizontalOptions="Start"
Margin="0"/>
<!-- Valor -->
<Label Grid.Row="0"
Grid.Column="2"
Text="Valor:"
FontSize="Small"
Margin="0"
HorizontalOptions="Center"/>
<Label Grid.Row="0"
Grid.Column="3"
Text="{Binding VALOR}"
FontSize="Small"
TextColor="Black"
HorizontalOptions="Start"
Margin="0"/>
<!-- Hora do Lance -->
<Label Grid.Row="0"
Grid.Column="4"
Text="Hora lance:"
FontSize="Small"
HorizontalOptions="End"
Margin="0"/>
<Label Grid.Row="0"
Grid.Column="5"
Text="{Binding HR_LANCE}"
FontSize="Small"
TextColor="Black"
HorizontalOptions="End"
Margin="0"/>
<!-- Repartir conteudo com cor -->
<BoxView Grid.Row="1"
Grid.Column="0"
Grid.ColumnSpan="6"
BackgroundColor="Red"/>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
Did you use Stacklayout to organize them? I understood what you meant, but I put to work without Stacklayout and it is still difficult to organize.
– Deivid Souza
No. I provide the code exactly like yours. I only changed the bindings pada my data collection. I will share the full code @Deividsouza
– Diego Rafael Souza
@Deividsouza, I posted the source code of the example I used. you did so and it didn’t work? what results did you get?
– Diego Rafael Souza
Thanks @Diego
– Deivid Souza