A Microsoft framework for building cross-platform mobile apps using .NET and C# with native performance and user interfaces.
Hello,
Welcome to our Microsoft Q&A platform!
created a table (with 312 rows and 4 columns) for one of the xaml files.
The Grid layout should not be confused with tables, and is not intended to present tabular data. Unlike HTML tables, a Grid is intended for laying out content. For displaying tabular data, consider using a ListView, CollectionView, or TableView. Please see Gird's description:https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/layouts/grid
Based on your 312 rows and performance requirements, I recommend you to use ListView, CollectionView to achieve it, Your gird rows have same layout. You can create a ListView like following code(I use data-binding's way to achieve it).
<StackLayout BackgroundColor="#2b608a">
<ListView ItemsSource="{Binding employees}" HasUnevenRows="True">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout>
<Grid RowSpacing="3" ColumnSpacing="3">
<Grid.ColumnDefinitions >
<ColumnDefinition Width="*" />
<ColumnDefinition Width="50" />
<ColumnDefinition Width="50" />
<ColumnDefinition Width="50" />
</Grid.ColumnDefinitions>
<BoxView BackgroundColor="#dcf0ff"/>
<Label Text="{Binding Text1}" FontAttributes="Bold" TextColor="#084390"
VerticalOptions="Center" />
<BoxView Grid.Column="1" BackgroundColor="#dcf0ff" />
<Label Grid.Column="1"
Text="{Binding Text2}" FontAttributes="Bold" TextColor="#084390"
VerticalOptions="Center" HorizontalOptions="Center"/>
<BoxView Grid.Column="2" BackgroundColor="#dcf0ff"/>
<Label Grid.Column="2"
Text="{Binding Text3}" FontAttributes="Bold" TextColor="#084390"
VerticalOptions="Center" HorizontalOptions="Center"/>
<BoxView Grid.Column="3" BackgroundColor="#dcf0ff"/>
<Label Grid.Column="3" TextColor="#084390"
Text="{Binding Text4}" FontAttributes="Bold"
VerticalOptions="Center" HorizontalOptions="Center"/>
</Grid>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.