{"id":551,"date":"2020-08-30T19:15:51","date_gmt":"2020-08-30T19:15:51","guid":{"rendered":"https:\/\/serkanseker.com\/?p=551"},"modified":"2021-02-23T07:55:35","modified_gmt":"2021-02-23T07:55:35","slug":"xamarin-forms-listview-grouping","status":"publish","type":"post","link":"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/","title":{"rendered":"Xamarin.Forms ListView Grouping"},"content":{"rendered":"\n<p><strong>Grouping <\/strong>sequential data to reduce data complexity after connecting data to <strong>ListView <\/strong>in mobile apps is a good solution. We often see this when enumerating saved contacts in phonebook and messaging applications. It may seem complicated to do this with existing Xamarin controls. Fortunately, it&#8217;s easy to do with the SfListView plugin.<\/p>\n\n\n\n<p>At the end of this article, you will be able to sort the data in the ListView alphabetically and group them by the first character of the ordered data. This time, I will use one of the <a href=\"https:\/\/serkanseker.com\/install-and-manage-nuget-packages\/\" target=\"_blank\" rel=\"noreferrer noopener\">most useful plugins<\/a>, Syncfusion.Xamarin.SfListView, not with Xamarin&#8217;s own controls. Also, in this sample project, I will apply the <a href=\"https:\/\/serkanseker.com\/xamarin-forms-mvvm-pattern\/\" target=\"_blank\" rel=\"noreferrer noopener\">MVVM model<\/a> with <a href=\"https:\/\/serkanseker.com\/xamarin-forms-data-binding-context\/\" target=\"_blank\" rel=\"noreferrer noopener\">Data Binding<\/a>.<\/p>\n\n\n\n<p>So, let\u2019s started. Follow the steps below in order.<\/p>\n\n\n\n<div class=\"schema-how-to wp-block-yoast-how-to-block\"><p class=\"schema-how-to-description\"><\/p> <ol class=\"schema-how-to-steps\"><li class=\"schema-how-to-step\" id=\"how-to-step-1614064657485\"><strong class=\"schema-how-to-step-name\"><a href=\"https:\/\/serkanseker.com\/xamarin-forms-listview-grouping\/#step-1\">Install Syncfusion.Xamarin.SfListView Plugin<\/a><\/strong> <p class=\"schema-how-to-step-text\"><\/p> <\/li><li class=\"schema-how-to-step\" id=\"how-to-step-1614064669110\"><strong class=\"schema-how-to-step-name\"><a href=\"https:\/\/serkanseker.com\/xamarin-forms-listview-grouping\/#step-2\">Launch the SfListView on Each Platform<\/a><\/strong> <p class=\"schema-how-to-step-text\"><\/p> <\/li><li class=\"schema-how-to-step\" id=\"how-to-step-1614064677373\"><strong class=\"schema-how-to-step-name\"><a href=\"https:\/\/serkanseker.com\/xamarin-forms-listview-grouping\/#step-3\">Implement MVVM Model<\/a><\/strong> <p class=\"schema-how-to-step-text\"><a href=\"https:\/\/serkanseker.com\/xamarin-forms-listview-grouping\/#model-class\">1)Model Class<br\/><\/a><a href=\"https:\/\/serkanseker.com\/xamarin-forms-listview-grouping\/#view-model-class\">2)ViewModel Classes<br\/><\/a><a href=\"https:\/\/serkanseker.com\/xamarin-forms-listview-grouping\/#views-page\">3)Helpers Class<br\/>4)Views Page<\/a><\/p> <\/li><li class=\"schema-how-to-step\" id=\"how-to-step-1614064973235\"><strong class=\"schema-how-to-step-name\"><a href=\"https:\/\/serkanseker.com\/xamarin-forms-listview-grouping\/#conclusion\">Conclusion<\/a><\/strong> <p class=\"schema-how-to-step-text\"><\/p> <\/li><\/ol><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step-1\">Step 1 \u2013 Install Syncfusion.Xamarin.SfListView Plugin<\/h2>\n\n\n\n<p>First, you need to install&nbsp;<a href=\"https:\/\/www.nuget.org\/packages\/Syncfusion.Xamarin.SfListView\" target=\"_blank\" rel=\"noreferrer noopener\">Syncfusion.Xamarin.SfListView<\/a>&nbsp;plugin in your Xamarin.Forms project. There are two ways to do this. You can find details in the&nbsp;<a href=\"https:\/\/serkanseker.com\/install-and-manage-nuget-packages\/\" target=\"_blank\" rel=\"noreferrer noopener\">How To Install and Manage NuGet Packages<\/a>&nbsp;article.<\/p>\n\n\n\n<p>Type the following code into Package Manager Console and run it.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Install-Package Syncfusion.Xamarin.SfListView -Version 18.4.0.34<\/code><\/pre>\n\n\n\n<p>Alternatively, you can install the plugin from NuGet Package Manager. First, right click on the project folder. Then click on Manage NuGet Packages for Solution option. Go to the Browse tab in the window that opens. Finally, type Syncfusion.Xamarin.SfListView in the Search bar and search. And install the plugin on all platforms.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/serkanseker.com\/wp-content\/uploads\/2020\/08\/Install-Syncfusion.Xamarin.SfListView-Plugin.png\" alt=\"Install Syncfusion.Xamarin.SfListView Plugin\" class=\"wp-image-3003\"\/><figcaption>Install Syncfusion.Xamarin.SfListView Plugin<\/figcaption><\/figure>\n\n\n\n<p>If you use Syncfusion plugins in the project without Registration License, you will get a warning popup. To use this plugin without any warning messages, you must register with Syncfusion and obtain a Registration License. I explained&nbsp;<a href=\"https:\/\/serkanseker.com\/syncfusion-community-license-key\/\" target=\"_blank\" rel=\"noreferrer noopener\">how to register for Syncfusion and get License<\/a>.<\/p>\n\n\n\n<p>Let me explain briefly as follows.<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>First create an account in Syncfusion.<\/li><li>Then get a Registration License for Xamarin.Forms apps.<\/li><li>Finally, add this license to the&nbsp;<strong>App()<\/strong>&nbsp;constructor method of&nbsp;<strong>App.xaml.cs<\/strong>&nbsp;class as follows.<\/li><\/ol>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-csharp\">public App()\n{\n    Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense(&quot;YOUR REGISTER LICENCE&quot;);\n    InitializeComponent();\n    MainPage = new ContentPage();\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step-2\">Step 2 \u2013 Launch the SfListView on Each Platform<\/h2>\n\n\n\n<p>To use the SfListView plugin in Xamarin, you must launch it on a platform specific. So, after installing the plugin, you cannot use it directly.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Android<\/h2>\n\n\n\n<p>Android platform does not require any additional configuration to render the progress bar.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">iOS<\/h2>\n\n\n\n<p>To launch the SfListView plugin on the iOS platform, go to the AppDelegate.cs class. Then call the Init() method inside the FinishedLaunching() method. As follows. Thus, every time the AppDelegate class launch, the SfListView plugin will also initialize.<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-csharp\">using Syncfusion.XForms.iOS.EffectsView;\npublic override bool FinishedLaunching(UIApplication app, NSDictionary options)\n{\n    \u2026\n    global::Xamarin.Forms.Forms.Init ();\n    SfListViewRenderer.Init();\n    SfEffectsViewRenderer.Init();  \/\/Initialize only when effects view is added to Listview.\n    LoadApplication (new App ());\n    \u2026\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step-3\">Step 3 &#8211; Implement MVVM Model<\/h2>\n\n\n\n<p>After installing and launching the SfListView plugin, let&#8217;s start implementing the MVVM model. Our motivation for this project is to sort and group people in a phonebook list alphabetically in ListView. Follow the steps below in order to reach the result.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"model-class\">Model Class<\/h2>\n\n\n\n<p>When implementing the MVVM architecture, we first need to create a model class that is the template for the data. Add a folder named Models to the project and create a class named Contact.cs within that folder.<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-csharp\">    public class Contact\n    {\n        public string Name { get; set; }\n        public string Surname { get; set; }\n        public string Phone { get; set; }\n        public string Image { get; set; }\n    }<\/code><\/pre>\n\n\n\n<p>Model class like this. Name, surname, phone and image variables are kept for each Contact.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"view-model-class\">ViewModel Classes<\/h2>\n\n\n\n<p>In the MVVM architecture, the ViewModel class is created to bind the View and Model classes. For this, add a folder named ViewModels to the project.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"base-view-model\">BaseViewModel<\/h3>\n\n\n\n<p>We need a base ViewModel class to control data changes. The BaseViewModel class is required to report changes to the Model class to the View. Create a class named BaseViewModel.cs inside the ViewModels folder. This will inherit from the INotifyPropertyChanged interface.<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-csharp\">public class BaseViewModel : INotifyPropertyChanged\n{\n    public event PropertyChangedEventHandler PropertyChanged;\n    public void OnPropertyChanged([CallerMemberName] string name = &quot;&quot;)\n    {\n        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));\n    }\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"contact-view-model\">ContactViewModel<\/h3>\n\n\n\n<p>Add a class named ContactViewModel.cs to the ViewModels folder. This class will be the class to handle the data and will inherit the BaseViewModel.cs class.<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-csharp\">public class ContactViewModel : BaseViewModel\n{\n    public ContactViewModel()\n    {\n        ContactList = GetContact();\n    }\n\n    private ObservableCollection&lt;Contact&gt; GetContact()\n    {\n        return new ObservableCollection&lt;Contact&gt;\n            {\n                new Contact {Name=&quot;Serkan&quot;, Surname=&quot;\u015eeker&quot;, Phone=&quot;000-000&quot;,Image=&quot;http:\/\/www.pngall.com\/wp-content\/uploads\/5\/Profile-PNG-File.png&quot;},\n                new Contact {Name=&quot;Smith&quot;, Surname=&quot;Adams&quot;, Phone=&quot;000-000&quot;,Image=&quot;http:\/\/www.pngall.com\/wp-content\/uploads\/5\/Profile-PNG-File.png&quot;},\n                new Contact {Name=&quot;Johnson&quot;, Surname=&quot;Mitchell&quot;, Phone=&quot;000-000&quot;, Image=&quot;http:\/\/www.pngall.com\/wp-content\/uploads\/5\/Profile-PNG-File.png&quot;},\n                new Contact {Name=&quot;Williams&quot;, Surname=&quot;Turner&quot;, Phone=&quot;000-000&quot;, Image=&quot;http:\/\/www.pngall.com\/wp-content\/uploads\/5\/Profile-PNG-File.png&quot;},\n                new Contact {Name=&quot;Brown&quot;, Surname=&quot;Reyes&quot;, Phone=&quot;000-000&quot;, Image=&quot;http:\/\/www.pngall.com\/wp-content\/uploads\/5\/Profile-PNG-File.png&quot;},\n                new Contact {Name=&quot;Wilson&quot;, Surname=&quot;Reed&quot;, Phone=&quot;000-000&quot;, Image=&quot;http:\/\/www.pngall.com\/wp-content\/uploads\/5\/Profile-PNG-File.png&quot;},\n                new Contact {Name=&quot;Anderson&quot;, Surname=&quot;Watson&quot;, Phone=&quot;000-000&quot;, Image=&quot;http:\/\/www.pngall.com\/wp-content\/uploads\/5\/Profile-PNG-File.png&quot;},\n                new Contact {Name=&quot;Clark&quot;, Surname=&quot;\u015eeker&quot;, Phone=&quot;000-000&quot;, Image=&quot;http:\/\/www.pngall.com\/wp-content\/uploads\/5\/Profile-PNG-File.png&quot;},\n                new Contact {Name=&quot;Ramirez&quot;, Surname=&quot;Mitchell&quot;, Phone=&quot;000-000&quot;, Image=&quot;http:\/\/www.pngall.com\/wp-content\/uploads\/5\/Profile-PNG-File.png&quot;},\n                new Contact {Name=&quot;Lewis&quot;, Surname=&quot;Ruiz&quot;, Phone=&quot;000-000&quot;, Image=&quot;http:\/\/www.pngall.com\/wp-content\/uploads\/5\/Profile-PNG-File.png&quot;},\n                new Contact {Name=&quot;Allen&quot;, Surname=&quot;Reyes&quot;, Phone=&quot;000-000&quot;,Image=&quot;http:\/\/www.pngall.com\/wp-content\/uploads\/5\/Profile-PNG-File.png&quot;},\n                new Contact {Name=&quot;Wright&quot;, Surname=&quot;Ruiz&quot;, Phone=&quot;000-000&quot;, Image=&quot;http:\/\/www.pngall.com\/wp-content\/uploads\/5\/Profile-PNG-File.png&quot;},\n                new Contact {Name=&quot;Torres&quot;, Surname=&quot;Watson&quot;, Phone=&quot;000-000&quot;, Image=&quot;http:\/\/www.pngall.com\/wp-content\/uploads\/5\/Profile-PNG-File.png&quot;},\n                new Contact {Name=&quot;Hill&quot;, Surname=&quot;Reed&quot;, Phone=&quot;000-000&quot;, Image=&quot;http:\/\/www.pngall.com\/wp-content\/uploads\/5\/Profile-PNG-File.png&quot;},\n                new Contact {Name=&quot;Adams&quot;, Surname=&quot;Turner&quot;, Phone=&quot;000-000&quot;, Image=&quot;http:\/\/www.pngall.com\/wp-content\/uploads\/5\/Profile-PNG-File.png&quot;},\n\n            };\n    }\n\n    private ObservableCollection&lt;Contact&gt; contactList;\n    public ObservableCollection&lt;Contact&gt; ContactList\n    {\n        get { return contactList; }\n        set\n        {\n            contactList = value;\n            OnPropertyChanged();\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<p>Here, let&#8217;s create an ObservableCollection and manually enter the data to use when connecting the data to the ListView. There will be no database operation in this project.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"helpers-class\">Helpers Class<\/h2>\n\n\n\n<p>Data does not come grouped directly in the ListView. We can do the grouping process with the method we wrote using the features of the SfListView plugin.<\/p>\n\n\n\n<p>To keep such behavior classes together, add a folder named Helpers to the project and create a class named Behaviors.cs within that folder.<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-csharp\">public class SfListViewGroupingBehavior : Behavior&lt;Syncfusion.ListView.XForms.SfListView&gt;\n{\n\n    #region Fields\n\n    private Syncfusion.ListView.XForms.SfListView ListView;\n\n    #endregion\n\n    #region Overrides\n    protected override void OnAttachedTo(Syncfusion.ListView.XForms.SfListView bindable)\n    {\n        ListView = bindable;\n        ListView.DataSource.GroupDescriptors.Add(new GroupDescriptor()\n        {\n            PropertyName = &quot;Name&quot;,\n            KeySelector = (object obj1) =&gt;\n            {\n                var item = (obj1 as Contact);\n                return item.Name[0].ToString();\n            },\n        });\n        base.OnAttachedTo(bindable);\n    }\n\n    protected override void OnDetachingFrom(Syncfusion.ListView.XForms.SfListView bindable)\n    {\n        ListView = null;\n        base.OnDetachingFrom(bindable);\n    }\n    #endregion\n\n}<\/code><\/pre>\n\n\n\n<p>Notice that this class inherited the SfListView extension&#8217;s generic class named Behavior, and we override some methods of that class.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"views-page\">Views Page<\/h2>\n\n\n\n<p>We have reached the top rung of MVVM architecture. Add a folder named Views to the project and create a ContentPage named ContactPage.xaml within that folder. This page is the page where the designs will be seen by the end user.<\/p>\n\n\n\n<p>NOTE: Don&#8217;t forget to add the SfListView namespace to ContentPage.<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-markup\">xmlns:syncfusion=&quot;clr-namespace:Syncfusion.ListView.XForms;assembly=Syncfusion.SfListView.XForms&quot; <\/code><\/pre>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-markup\">&lt;ContentPage.BindingContext&gt;\n    &lt;local:ContactViewModel\/&gt;\n&lt;\/ContentPage.BindingContext&gt;\n\n&lt;ContentPage.Content&gt;\n\n    &lt;syncfusion:SfListView x:Name=&quot;listView&quot; ItemsSource=&quot;{Binding ContactList}&quot;\n                               ItemSize=&quot;100&quot; \n\t\t\t\t\t   FocusBorderThickness=&quot;0&quot;\n                       IsStickyGroupHeader=&quot;True&quot;\n                       AllowGroupExpandCollapse=&quot;True&quot; \n                       SelectionBackgroundColor=&quot;#d6e0f0&quot;\n                             GroupHeaderSize=&quot;{OnPlatform Default=40, macOS=70}&quot;  &gt;\n\n        &lt;syncfusion:SfListView.DataSource&gt;\n\n            &lt;data:DataSource&gt;\n                &lt;data:DataSource.SortDescriptors&gt;\n                    &lt;data:SortDescriptor PropertyName=&quot;Name&quot; Direction=&quot;Ascending&quot;\/&gt;\n                &lt;\/data:DataSource.SortDescriptors&gt;\n            &lt;\/data:DataSource&gt;\n\n        &lt;\/syncfusion:SfListView.DataSource&gt;\n\n        &lt;syncfusion:SfListView.GroupHeaderTemplate&gt;\n            &lt;DataTemplate&gt;\n                &lt;ViewCell&gt;\n                    &lt;ViewCell.View&gt;\n                        &lt;StackLayout Orientation=&quot;Horizontal&quot; BackgroundColor=&quot;#E4E4E4&quot;&gt;\n                            &lt;Label Text=&quot;{Binding Key}&quot; \n                         FontSize=&quot;22&quot; \n                         FontAttributes=&quot;Bold&quot;\n                         VerticalOptions=&quot;Center&quot; \n                         HorizontalOptions=&quot;Start&quot; \n                         Margin=&quot;20,0,0,0&quot; \/&gt;\n                        &lt;\/StackLayout&gt;\n                    &lt;\/ViewCell.View&gt;\n                &lt;\/ViewCell&gt;\n            &lt;\/DataTemplate&gt;\n        &lt;\/syncfusion:SfListView.GroupHeaderTemplate&gt;\n\n        &lt;syncfusion:SfListView.Behaviors&gt;\n            &lt;local1:SfListViewGroupingBehavior\/&gt;\n        &lt;\/syncfusion:SfListView.Behaviors&gt;\n\n        &lt;syncfusion:SfListView.ItemTemplate&gt;\n            &lt;DataTemplate&gt;\n                &lt;Grid Padding=&quot;10&quot;&gt;\n                    &lt;Grid.RowDefinitions&gt;\n                        &lt;RowDefinition Height=&quot;0.4*&quot; \/&gt;\n                        &lt;RowDefinition Height=&quot;0.6*&quot; \/&gt;\n                    &lt;\/Grid.RowDefinitions&gt;\n                    &lt;Grid.ColumnDefinitions&gt;\n                        &lt;ColumnDefinition Width=&quot;Auto&quot;\/&gt;\n                        &lt;ColumnDefinition Width=&quot;Auto&quot;\/&gt;\n                    &lt;\/Grid.ColumnDefinitions&gt;\n                    &lt;Image Grid.Row=&quot;0&quot; Grid.Column=&quot;0&quot; Grid.RowSpan=&quot;2&quot; Source=&quot;{Binding Image}&quot;\/&gt;\n                    &lt;Label Grid.Row=&quot;0&quot; Grid.Column=&quot;1&quot; Text=&quot;{Binding Name}&quot; FontAttributes=&quot;Bold&quot; TextColor=&quot;Black&quot; FontSize=&quot;21&quot; \/&gt;\n                    &lt;Label Grid.Row=&quot;1&quot; Grid.Column=&quot;1&quot; Text=&quot;{Binding Phone}&quot; TextColor=&quot;Black&quot; FontSize=&quot;15&quot;\/&gt;\n                &lt;\/Grid&gt;\n            &lt;\/DataTemplate&gt;\n        &lt;\/syncfusion:SfListView.ItemTemplate&gt;\n\n    &lt;\/syncfusion:SfListView&gt;\n\n&lt;\/ContentPage.Content&gt;<\/code><\/pre>\n\n\n\n<p>And finally, change the MainPage property to the View class in the App.xaml.cs class.<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-csharp\">public App()\n{\n    InitializeComponent();\n    MainPage = new ContactPage();\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"conclusion\">Conclusion<\/h2>\n\n\n\n<p>Our application is ready. We have done the sorting and grouping operations. The contacts will appear as sorted and grouped in the ListView.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/serkanseker.com\/wp-content\/uploads\/2020\/08\/Xamarin.Forms-ListView-Grouping.gif\" alt=\"Xamarin.Forms ListView Grouping\" class=\"wp-image-554\" width=\"300\" height=\"533\"\/><figcaption>Xamarin.Forms ListView Grouping Alphabetically<\/figcaption><\/figure><\/div>\n\n\n\n<p>In this post, I explained how to how to group the data in ListView using the SfListView plugin in a Xamarin.Forms project. I hope it was useful.<\/p>\n\n\n\n<p>If you\u2019re still not sure what to do, or if you got any errors, then I suggest you use the comment section below and let me know! I am here to help!<\/p>\n\n\n\n<p><strong>Also, share this blog post on social media and help more people learn.<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Related Links<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/serkanseker.com\/xamarin-forms-mvvm-pattern\/\" target=\"_blank\" rel=\"noreferrer noopener\">Xamarin.Forms MVVM Pattern<\/a><\/li><li><a href=\"https:\/\/serkanseker.com\/install-and-manage-nuget-packages\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install and Manage NuGet Packages<\/a><\/li><li><a href=\"https:\/\/serkanseker.com\/syncfusion-community-license-key\/\" target=\"_blank\" rel=\"noreferrer noopener\">Syncfusion Community License Key<\/a><\/li><li><a style=\"font-family: Roboto, var(--nv-fallback-ff); letter-spacing: 0px; background-color: var(--nv-site-bg);\" href=\"https:\/\/serkanseker.com\/xamarin-forms-data-binding-context\/\" target=\"_blank\" rel=\"noreferrer noopener\">Xamarin.Forms Data Binding Context<\/a><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Grouping sequential data to reduce data complexity after connecting data to ListView in mobile apps is a good solution. We often see this when enumerating saved contacts in phonebook and messaging applications. It may seem complicated to do this with existing Xamarin controls. Fortunately, it&#8217;s easy to do with the SfListView plugin.<\/p>\n","protected":false},"author":1,"featured_media":215,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","footnotes":""},"categories":[572,21,39],"tags":[33,42,570,28,4,5],"class_list":["post-551","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-nuget","category-xamarin","category-xamarin-forms","tag-listview","tag-mvvm","tag-nuget","tag-syncfusion","tag-xamarin","tag-xamarin-forms"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Xamarin.Forms ListView Grouping - Serkan Seker TR<\/title>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Xamarin.Forms ListView Grouping - Serkan Seker TR\" \/>\n<meta property=\"og:description\" content=\"Grouping sequential data to reduce data complexity after connecting data to ListView in mobile apps is a good solution. We often see this when enumerating saved contacts in phonebook and messaging applications. It may seem complicated to do this with existing Xamarin controls. Fortunately, it&#039;s easy to do with the SfListView plugin.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/\" \/>\n<meta property=\"og:site_name\" content=\"Serkan Seker TR\" \/>\n<meta property=\"article:published_time\" content=\"2020-08-30T19:15:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-02-23T07:55:35+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/serkanseker.com\/tr\/wp-content\/uploads\/2020\/12\/Xamarin.Forms-ListView-Grouping.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1\" \/>\n\t<meta property=\"og:image:height\" content=\"1\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"serkanadmin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"serkanadmin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/\"},\"author\":{\"name\":\"serkanadmin\",\"@id\":\"https:\/\/serkanseker.com\/tr\/#\/schema\/person\/841fcc69b248e08e52c4190963caeaf5\"},\"headline\":\"Xamarin.Forms ListView Grouping\",\"datePublished\":\"2020-08-30T19:15:51+00:00\",\"dateModified\":\"2021-02-23T07:55:35+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/\"},\"wordCount\":939,\"commentCount\":1,\"image\":{\"@id\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/serkanseker.com\/tr\/wp-content\/uploads\/2020\/12\/Xamarin.Forms-ListView-Grouping.jpg\",\"keywords\":[\"ListView\",\"MVVM\",\"NuGet\",\"syncfusion\",\"xamarin\",\"xamarin.forms\"],\"articleSection\":[\"NuGet\",\"Xamarin\",\"Xamarin.Forms\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/\",\"url\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/\",\"name\":\"Xamarin.Forms ListView Grouping - Serkan Seker TR\",\"isPartOf\":{\"@id\":\"https:\/\/serkanseker.com\/tr\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/serkanseker.com\/tr\/wp-content\/uploads\/2020\/12\/Xamarin.Forms-ListView-Grouping.jpg\",\"datePublished\":\"2020-08-30T19:15:51+00:00\",\"dateModified\":\"2021-02-23T07:55:35+00:00\",\"author\":{\"@id\":\"https:\/\/serkanseker.com\/tr\/#\/schema\/person\/841fcc69b248e08e52c4190963caeaf5\"},\"breadcrumb\":{\"@id\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/#primaryimage\",\"url\":\"https:\/\/serkanseker.com\/tr\/wp-content\/uploads\/2020\/12\/Xamarin.Forms-ListView-Grouping.jpg\",\"contentUrl\":\"https:\/\/serkanseker.com\/tr\/wp-content\/uploads\/2020\/12\/Xamarin.Forms-ListView-Grouping.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/serkanseker.com\/tr\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Xamarin.Forms ListView Grouping\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/serkanseker.com\/tr\/#website\",\"url\":\"https:\/\/serkanseker.com\/tr\/\",\"name\":\"Serkan Seker TR\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/serkanseker.com\/tr\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/serkanseker.com\/tr\/#\/schema\/person\/841fcc69b248e08e52c4190963caeaf5\",\"name\":\"serkanadmin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/serkanseker.com\/tr\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/93ddc1f96117bf468976afe93a077eda77de96bcdb48dc749903598a546786a3?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/93ddc1f96117bf468976afe93a077eda77de96bcdb48dc749903598a546786a3?s=96&d=mm&r=g\",\"caption\":\"serkanadmin\"},\"sameAs\":[\"https:\/\/serkanseker.com\"],\"url\":\"https:\/\/serkanseker.com\/tr\/author\/serkanadmin\/\"},{\"@type\":\"HowTo\",\"@id\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/#howto-1\",\"name\":\"Xamarin.Forms ListView Grouping\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/#article\"},\"description\":\"\",\"step\":[{\"@type\":\"HowToStep\",\"url\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/#how-to-step-1614064657485\",\"text\":\"Install Syncfusion.Xamarin.SfListView Plugin\"},{\"@type\":\"HowToStep\",\"url\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/#how-to-step-1614064669110\",\"text\":\"Launch the SfListView on Each Platform\"},{\"@type\":\"HowToStep\",\"url\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/#how-to-step-1614064677373\",\"name\":\"Implement MVVM Model\",\"itemListElement\":[{\"@type\":\"HowToDirection\",\"text\":\"<a href=\\\"https:\/\/serkanseker.com\/xamarin-forms-listview-grouping\/#model-class\\\">1)Model Class<br\/><\/a><a href=\\\"https:\/\/serkanseker.com\/xamarin-forms-listview-grouping\/#view-model-class\\\">2)ViewModel Classes<br\/><\/a><a href=\\\"https:\/\/serkanseker.com\/xamarin-forms-listview-grouping\/#views-page\\\">3)Helpers Class<br\/>4)Views Page<\/a>\"}]},{\"@type\":\"HowToStep\",\"url\":\"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/#how-to-step-1614064973235\",\"text\":\"Conclusion\"}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Xamarin.Forms ListView Grouping - Serkan Seker TR","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"Xamarin.Forms ListView Grouping - Serkan Seker TR","og_description":"Grouping sequential data to reduce data complexity after connecting data to ListView in mobile apps is a good solution. We often see this when enumerating saved contacts in phonebook and messaging applications. It may seem complicated to do this with existing Xamarin controls. Fortunately, it's easy to do with the SfListView plugin.","og_url":"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/","og_site_name":"Serkan Seker TR","article_published_time":"2020-08-30T19:15:51+00:00","article_modified_time":"2021-02-23T07:55:35+00:00","og_image":[{"url":"https:\/\/serkanseker.com\/tr\/wp-content\/uploads\/2020\/12\/Xamarin.Forms-ListView-Grouping.jpg","width":1,"height":1,"type":"image\/jpeg"}],"author":"serkanadmin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"serkanadmin","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/#article","isPartOf":{"@id":"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/"},"author":{"name":"serkanadmin","@id":"https:\/\/serkanseker.com\/tr\/#\/schema\/person\/841fcc69b248e08e52c4190963caeaf5"},"headline":"Xamarin.Forms ListView Grouping","datePublished":"2020-08-30T19:15:51+00:00","dateModified":"2021-02-23T07:55:35+00:00","mainEntityOfPage":{"@id":"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/"},"wordCount":939,"commentCount":1,"image":{"@id":"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/#primaryimage"},"thumbnailUrl":"https:\/\/serkanseker.com\/tr\/wp-content\/uploads\/2020\/12\/Xamarin.Forms-ListView-Grouping.jpg","keywords":["ListView","MVVM","NuGet","syncfusion","xamarin","xamarin.forms"],"articleSection":["NuGet","Xamarin","Xamarin.Forms"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/","url":"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/","name":"Xamarin.Forms ListView Grouping - Serkan Seker TR","isPartOf":{"@id":"https:\/\/serkanseker.com\/tr\/#website"},"primaryImageOfPage":{"@id":"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/#primaryimage"},"image":{"@id":"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/#primaryimage"},"thumbnailUrl":"https:\/\/serkanseker.com\/tr\/wp-content\/uploads\/2020\/12\/Xamarin.Forms-ListView-Grouping.jpg","datePublished":"2020-08-30T19:15:51+00:00","dateModified":"2021-02-23T07:55:35+00:00","author":{"@id":"https:\/\/serkanseker.com\/tr\/#\/schema\/person\/841fcc69b248e08e52c4190963caeaf5"},"breadcrumb":{"@id":"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/#primaryimage","url":"https:\/\/serkanseker.com\/tr\/wp-content\/uploads\/2020\/12\/Xamarin.Forms-ListView-Grouping.jpg","contentUrl":"https:\/\/serkanseker.com\/tr\/wp-content\/uploads\/2020\/12\/Xamarin.Forms-ListView-Grouping.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/serkanseker.com\/tr\/"},{"@type":"ListItem","position":2,"name":"Xamarin.Forms ListView Grouping"}]},{"@type":"WebSite","@id":"https:\/\/serkanseker.com\/tr\/#website","url":"https:\/\/serkanseker.com\/tr\/","name":"Serkan Seker TR","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/serkanseker.com\/tr\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/serkanseker.com\/tr\/#\/schema\/person\/841fcc69b248e08e52c4190963caeaf5","name":"serkanadmin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/serkanseker.com\/tr\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/93ddc1f96117bf468976afe93a077eda77de96bcdb48dc749903598a546786a3?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/93ddc1f96117bf468976afe93a077eda77de96bcdb48dc749903598a546786a3?s=96&d=mm&r=g","caption":"serkanadmin"},"sameAs":["https:\/\/serkanseker.com"],"url":"https:\/\/serkanseker.com\/tr\/author\/serkanadmin\/"},{"@type":"HowTo","@id":"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/#howto-1","name":"Xamarin.Forms ListView Grouping","mainEntityOfPage":{"@id":"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/#article"},"description":"","step":[{"@type":"HowToStep","url":"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/#how-to-step-1614064657485","text":"Install Syncfusion.Xamarin.SfListView Plugin"},{"@type":"HowToStep","url":"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/#how-to-step-1614064669110","text":"Launch the SfListView on Each Platform"},{"@type":"HowToStep","url":"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/#how-to-step-1614064677373","name":"Implement MVVM Model","itemListElement":[{"@type":"HowToDirection","text":"<a href=\"https:\/\/serkanseker.com\/xamarin-forms-listview-grouping\/#model-class\">1)Model Class<br\/><\/a><a href=\"https:\/\/serkanseker.com\/xamarin-forms-listview-grouping\/#view-model-class\">2)ViewModel Classes<br\/><\/a><a href=\"https:\/\/serkanseker.com\/xamarin-forms-listview-grouping\/#views-page\">3)Helpers Class<br\/>4)Views Page<\/a>"}]},{"@type":"HowToStep","url":"https:\/\/serkanseker.com\/tr\/xamarin-forms-listview-grouping\/#how-to-step-1614064973235","text":"Conclusion"}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/serkanseker.com\/tr\/wp-json\/wp\/v2\/posts\/551","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/serkanseker.com\/tr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/serkanseker.com\/tr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/serkanseker.com\/tr\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/serkanseker.com\/tr\/wp-json\/wp\/v2\/comments?post=551"}],"version-history":[{"count":0,"href":"https:\/\/serkanseker.com\/tr\/wp-json\/wp\/v2\/posts\/551\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/serkanseker.com\/tr\/wp-json\/wp\/v2\/media\/215"}],"wp:attachment":[{"href":"https:\/\/serkanseker.com\/tr\/wp-json\/wp\/v2\/media?parent=551"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/serkanseker.com\/tr\/wp-json\/wp\/v2\/categories?post=551"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/serkanseker.com\/tr\/wp-json\/wp\/v2\/tags?post=551"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}