{"id":23061651,"url":"https://github.com/syncfusionexamples/xamarin-forms-listview-inside-another-listview","last_synced_at":"2026-04-24T16:35:26.162Z","repository":{"id":54415772,"uuid":"200172565","full_name":"SyncfusionExamples/xamarin-forms-listview-inside-another-listview","owner":"SyncfusionExamples","description":"Example for loading xamarin forms listview inside another listview (nested listview).","archived":false,"fork":false,"pushed_at":"2024-02-15T13:42:28.000Z","size":1834,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-08T20:48:18.275Z","etag":null,"topics":["listview","nested-objects","sflistview","xamarin","xamarin-android","xamarin-forms","xamarin-ios","xamarin-listview","xamarin-uwp"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SyncfusionExamples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-02T05:43:08.000Z","updated_at":"2023-08-27T09:52:42.000Z","dependencies_parsed_at":"2024-02-15T14:52:48.671Z","dependency_job_id":null,"html_url":"https://github.com/SyncfusionExamples/xamarin-forms-listview-inside-another-listview","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SyncfusionExamples%2Fxamarin-forms-listview-inside-another-listview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SyncfusionExamples%2Fxamarin-forms-listview-inside-another-listview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SyncfusionExamples%2Fxamarin-forms-listview-inside-another-listview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SyncfusionExamples%2Fxamarin-forms-listview-inside-another-listview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SyncfusionExamples","download_url":"https://codeload.github.com/SyncfusionExamples/xamarin-forms-listview-inside-another-listview/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246952280,"owners_count":20859813,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["listview","nested-objects","sflistview","xamarin","xamarin-android","xamarin-forms","xamarin-ios","xamarin-listview","xamarin-uwp"],"created_at":"2024-12-16T03:18:02.250Z","updated_at":"2026-04-24T16:35:26.122Z","avatar_url":"https://github.com/SyncfusionExamples.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Working with Nested Xamarin.Forms ListView\n\nListView allows you to load another ListView inside its [ItemTemplate](https://help.syncfusion.com/cr/cref_files/xamarin/Syncfusion.SfListView.XForms~Syncfusion.ListView.XForms.SfListView~ItemTemplate.html). When the [AutoFitMode](https://help.syncfusion.com/cr/cref_files/xamarin/Syncfusion.SfListView.XForms~Syncfusion.ListView.XForms.SfListView~AutoFitMode.html) of the outer ListView is height, the size of the inner ListView will be allocated from the maximum screen size. Since the exact size for the inner list cannot not be obtained before loading the view.\n\nTo get a fixed height for the inner ListView, define a value in its `HeightRequest`. If the items inside the inner ListView are less, allocate the total extend of the inner list to its `HeightRequest`.\n\nFollow the steps to set the size for the outer ListView based on the extend of inner ListView:\n\nDefine a property in the Model class and bind it to the HeightRequest of inner ListView, as the height for various inner ListView has to be identified while scrolling.\nHook the container’s `PropertyChanged` event. When the height of the container changes, set the value of `TotalExtent` to the property bound to the HeightRequest.\nCall the `RefreshView` method asynchronously with few seconds delay in the `Loaded` event of the outer SfListView. The height requested for each inner SfListView will be set but the outer SfListView will not get any notification regarding the size change. So, call the RefreshView method asynchronously after loading the view.\n\n```\n\u003clistView:SfListView x:Name=\"listView\"  ItemsSource=\"{Binding ContactInfo}\" AutoFitMode=\"Height\" Loaded=\"listView_Loaded\" AllowGroupExpandCollapse=\"True\"\u003e\n    \u003clistView:SfListView.ItemTemplate\u003e\n        \u003cDataTemplate\u003e\n            \u003cViewCell\u003e\n                \u003cViewCell.View\u003e\n                    \u003cGrid\u003e\n                        \u003clocal:ExtendedListView x:Name=\"list1\" HeightRequest=\"{Binding InnerListHeight}\" ItemsSource=\"{Binding ContactDetails}\" ItemSize=\"75\"\u003e\n                            \u003clocal:ExtendedListView.ItemTemplate\u003e\n                                \u003cDataTemplate\u003e\n                                    \u003cStackLayout\u003e\n                                        \u003cImage Source=\"{Binding Image}\" /\u003e\n                                        \u003cLabel Text=\"{Binding Name}\" /\u003e\n                                        \u003cLabel Text=\"{Binding Number}\" /\u003e\n                                    \u003c/StackLayout\u003e\n                                \u003c/DataTemplate\u003e\n                            \u003c/local:ExtendedListView.ItemTemplate\u003e\n                        \u003c/local:ExtendedListView\u003e\n                    \u003c/Grid\u003e\n                \u003c/ViewCell.View\u003e\n            \u003c/ViewCell\u003e\n        \u003c/DataTemplate\u003e\n    \u003c/listView:SfListView.ItemTemplate\u003e\n\u003c/listView:SfListView\u003e \n```\n```\npublic partial class NestedListView : ContentPage\n{\n    public NestedListView()\n    {\n        InitializeComponent();\n    }\n\n    private async void listView_Loaded(object sender, Syncfusion.ListView.XForms.ListViewLoadedEventArgs e)\n    {\n        await Task.Delay(2000);\n        listView.RefreshView();\n    }\n}\n```\n```\nusing Syncfusion.ListView.XForms.Control.Helpers;\npublic class ExtendedListView : SfListView\n{\n    VisualContainer container;\n    public ExtendedListView()\n    {\n        container = this.GetVisualContainer();\n        container.PropertyChanged += Container_PropertyChanged;\n    }\n    \n    private void Container_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)\n    {\n        Device.BeginInvokeOnMainThread(async () =\u003e\n        {\n            var extent = (double)container.GetType().GetRuntimeProperties().FirstOrDefault(container =\u003e container.Name == \"TotalExtent\").GetValue(container);\n            if (e.PropertyName == \"Height\")\n                (this.BindingContext as ContactInfo_NestedListView).InnerListHeight = extent;\n        });\n    }\n}\n```\n\nTo know more about MVVM in ListView, please refer our documentation [here](https://help.syncfusion.com/xamarin/sflistview/mvvm)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyncfusionexamples%2Fxamarin-forms-listview-inside-another-listview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsyncfusionexamples%2Fxamarin-forms-listview-inside-another-listview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyncfusionexamples%2Fxamarin-forms-listview-inside-another-listview/lists"}