title: How to add Three Level ListView in ExpandableListView in xamarin android
body: <p>How to add one or more levels in Expandable listview in xamarin android.
  or how to create a tree view in xamarin android.</p>
  
  <p>I have found solution for a single level Listview.
  Below is my code.
  I am very new to xamarin android.
  Please help.
  Thanks in advance.</p>
  
  <p><strong>My MainActivity.cs:</strong></p>
  
  <pre><code>using Android.App;
  using Android.OS;
  using Android.Support.V7.App;
  using Android.Widget;
  using System.Collections.Generic;
  using System;
  namespace AndroidExpandableListView
  {
  [Activity(Label = "AndroidExpandableListView", MainLauncher = true, Icon = "@drawable/icon",
      Theme ="@style/MyTheme")]
  public class MainActivity : AppCompatActivity
  {
      ExpandableListViewAdapter mAdapter;
      ExpandableListView expandableListView;
      List&lt;string&gt; group = new List&lt;string&gt;();
      Dictionary&lt;string, List&lt;string&gt;&gt; dicMyMap = new Dictionary&lt;string, List&lt;string&gt;&gt;();
      protected override void OnCreate(Bundle bundle)
      {
          base.OnCreate(bundle);
  
          // Set our view from the "main" layout resource
          SetContentView(Resource.Layout.Main);
          var toolbar = FindViewById&lt;Android.Support.V7.Widget.Toolbar&gt;(Resource.Id.toolbar);
          SetSupportActionBar(toolbar);
          SupportActionBar.Title = "Expandable ListView";
          expandableListView = FindViewById&lt;ExpandableListView&gt;(Resource.Id.expandableListView);
  
          //Set Data
          SetData(out mAdapter);
          expandableListView.SetAdapter(mAdapter);
  
          expandableListView.ChildClick += (s, e) =&gt; {
              Toast.MakeText(this, "Clicked : " + mAdapter.GetChild(e.GroupPosition, e.ChildPosition), ToastLength.Short).Show();
          };
      }
  
      private void SetData(out ExpandableListViewAdapter mAdapter)
      {
          List&lt;string&gt; groupA = new List&lt;string&gt;();
          groupA.Add("A-1");
          groupA.Add("A-2");
          groupA.Add("A-3");
  
          List&lt;string&gt; groupB = new List&lt;string&gt;();
          groupB.Add("B-1");
          groupB.Add("B-2");
          groupB.Add("B-3");
  
          group.Add("Group A");
          group.Add("Group B");
  
          dicMyMap.Add(group[0], groupA);
          dicMyMap.Add(group[1], groupB);
  
          mAdapter = new ExpandableListViewAdapter(this, group, dicMyMap);
      }
  }
  }
  </code></pre>
  
  <p><strong>My ExpandableListViewAdapter.cs:</strong></p>
  
  <pre><code>namespace AndroidExpandableListView
  {
  public class ExpandableListViewAdapter : BaseExpandableListAdapter
  {
      private Context context;
      private List&lt;string&gt; listGroup;
      private Dictionary&lt;string, Dictionary&lt;string, List&lt;string&gt;&gt;&gt; lstChild;
  
      public ExpandableListViewAdapter(Context context, List&lt;string&gt; listGroup, Dictionary&lt;string, Dictionary&lt;string, List&lt;string&gt;&gt;&gt; lstChild)
      {
          this.context = context;
          this.listGroup = listGroup;
          this.lstChild = lstChild;
      }
  
      public override int GroupCount
      {
          get
          {
              return listGroup.Count;
          }
      }
  
      public override bool HasStableIds
      {
          get
          {
              return false;
          }
      }
  
      public override Java.Lang.Object GetChild(int groupPosition, int childPosition)
      {
          var result = new List&lt;string&gt;();
  
          lstChild.TryGetValue(listGroup[groupPosition], out result);
          return 0;// result[childPosition];
      }
  
      public override long GetChildId(int groupPosition, int childPosition)
      {
          return childPosition;
      }
  
      public override int GetChildrenCount(int groupPosition)
      {
          var result = new Dictionary&lt;string, List&lt;string&gt;&gt;();
          lstChild.TryGetValue(listGroup[groupPosition], out result);
          return result.Count;
      }
  
      public override View GetChildView(int groupPosition, int childPosition, bool isLastChild, View convertView, ViewGroup parent)
      {
          if (convertView == null)
          {
              LayoutInflater inflater = (LayoutInflater)context.GetSystemService(Context.LayoutInflaterService);
              convertView = inflater.Inflate(Resource.Layout.item_layout, null);
          }
          TextView textViewItem = convertView.FindViewById&lt;TextView&gt;(Resource.Id.item);
          string content = (string)GetChild(groupPosition, childPosition);
          textViewItem.Text = content;
          return convertView;
      }
  
      public override Java.Lang.Object GetGroup(int groupPosition)
      {
          return listGroup[groupPosition];
      }
  
      public override long GetGroupId(int groupPosition)
      {
          return groupPosition;
      }
  
      public override View GetGroupView(int groupPosition, bool isExpanded, View convertView, ViewGroup parent)
      {
          if (convertView == null)
          {
              LayoutInflater inflater = (LayoutInflater)context.GetSystemService(Context.LayoutInflaterService);
              convertView = inflater.Inflate(Resource.Layout.group_item, null);
          }
          string textGroup = (string)GetGroup(groupPosition);
          TextView textViewGroup = convertView.FindViewById&lt;TextView&gt;(Resource.Id.group);
          textViewGroup.Text = textGroup;
          return convertView;
      }
  
      public override bool IsChildSelectable(int groupPosition, int childPosition)
      {
          return true;
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I want to develop Listview like below image in xamarin android.I am not sure whether it is implementable using Expandable Listview cause I tried and nothing seems to work. Any links would be helpfull</p>
  
  <p><a href="https://i.stack.imgur.com/IMENC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IMENC.png" alt="enter image description here"></a></p>