- Home
- Forum
- Xamarin.Forms
- Listview size is not properly fit due to dynamic row- and static span count
Listview size is not properly fit due to dynamic row- and static span count
Hi, I've initially used SfListView to list my categories (financial types) with dynamic count in a span layout. 3 columns fixed and rows are dependent to count of items (from 4 up to 14 as of now).

Attachment: SfListviewLayout_3d2bdeef.zip
However, as you can notice from the screenshots, the layout of screen is terrible.
I want yellow SfListview to fit in the layout regarding to rows...
I cannot find the hint and looking forward to your precious support.
PS: I've got online chat support but abstracts from documentation and KB relavant to listview limitations did not help me or was not clear to solve the issue.
Grid.Row="1"
Padding="8"
AutoFitMode="Height"
BackgroundColor="LightYellow"
ItemSpacing="4"
ItemsSource="{Binding FinancialPlanTypes}"
SelectionBackgroundColor="Transparent">
Padding="0"
BackgroundColor="White"
BorderColor="LightGray"
CornerRadius="6"
HasShadow="true">
Grid.Row="1"
HeightRequest="64"
Source="{Binding ID, Converter={StaticResource planIconConverter}}"
WidthRequest="64" />
Attachment: SfListviewLayout_3d2bdeef.zip
SIGN IN To post a reply.
1 Reply
SS
SaiGanesh Sakthivel
Syncfusion Team
May 11, 2020 11:43 AM UTC
Hi Murat,
Thank you for contacting Syncfusion support.
We have checked the reported query “ListView size is not properly fit” from our end. We would like to inform that you can achieved your requirement by calculating the total height of listview Container by using container propertychanged and set the calculated totalextent value to the Listview HeightRequest. Please refer to the following code snippet for your reference.
Code Snippet
|
public MainPage()
{
InitializeComponent();
container = listView.GetVisualContainer();
container.PropertyChanged += Container_PropertyChanged;
}
private void Container_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
Device.BeginInvokeOnMainThread(async () =>
{
var totalextent = (double)container.GetType().GetRuntimeProperties().FirstOrDefault(container => container.Name == "TotalExtent").GetValue(container);
listView.HeightRequest = totalextent;
});
} |
Please refer to the following UG link.
UG Link: https://help.syncfusion.com/xamarin/listview/working-with-sflistview#working-with-nested-listview
We hope this helps. Please let us know if you need any further assistance.
Regards,
SaiGanesh Sakthivel
SIGN IN To post a reply.
- 1 Reply
- 2 Participants
-
MU Murat
- May 8, 2020 06:54 PM UTC
- May 11, 2020 11:43 AM UTC