https://github.com/syncfusionexamples/gridlayout-with-xamarin.forms-listview
This sample show case the grid layout in listview xamarin.forms
https://github.com/syncfusionexamples/gridlayout-with-xamarin.forms-listview
grid-layout sflistview xamarin-forms xamarin-listview xforms
Last synced: 8 months ago
JSON representation
This sample show case the grid layout in listview xamarin.forms
- Host: GitHub
- URL: https://github.com/syncfusionexamples/gridlayout-with-xamarin.forms-listview
- Owner: SyncfusionExamples
- Created: 2018-11-23T09:44:24.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2025-09-13T05:15:21.000Z (9 months ago)
- Last Synced: 2025-10-12T10:15:06.954Z (8 months ago)
- Topics: grid-layout, sflistview, xamarin-forms, xamarin-listview, xforms
- Language: C#
- Homepage:
- Size: 4.62 MB
- Stars: 0
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GridLayout with xamarin.forms listview
This sample show case the grid layout in listview xamarin.forms
## Sample
```xaml
. . .
. . .
C#:
protected override void OnSizeAllocated(double width, double height)
{
base.OnSizeAllocated(width, height);
try
{
base.OnSizeAllocated(width, height);
if (width > 0 && pageWidth != width)
{
var size = Application.Current.MainPage.Width / listView.ItemSize;
var gridLayout = listView.LayoutManager as GridLayout;
gridLayout.SpanCount = (int)size;
listView.LayoutManager = gridLayout;
}
}
catch (Exception ex)
{
}
}
```
## Requirements to run the demo
* Xamarin add-ons for Visual Studio (available via the Visual Studio installer).
## Troubleshooting
### Path too long exception
If you are facing path too long exception when building this example project, close Visual Studio and rename the repository to short and build the project.