title: Can I reorder the ListView items on the Run in Xamarin.Forms?
body: <p>Since listview has a eventhandler <strong>ChildrenReordered</strong> can we reorder the items in the list view during runtime??</p>
  
  <p>With the help of this <a href="http://iosapi.xamarin.com/?link=T%3AXamarin.Forms.ListView" rel="nofollow noreferrer">example here</a> I have created a similar view as in the image given below.
  Can anyone suggest a way to reorder listview on the run if possible. Now I remove the listview from the parent and create it again, suggestion for another workaround for reordering the items will be helpful.</p>
  
  <p><img src="https://i.stack.imgur.com/MacKg.jpg" alt="enter image description here"></p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>using System;
  using System.Linq;
  using System.Collections.Generic;
  using Xamarin.Forms;
  
  namespace OrderBy
  {
  class ListViewDemoPage : ContentPage
  {
      List&lt;SourceItem&gt; people = null;
  
      class SourceItem
      {
          public SourceItem(string Item)
          {
              this.Item = Item;
          }
  
          public string Item { private set; get; }
      };
  
      public ListViewDemoPage()
      {
  
          // Define some data.
          people = new List&lt;SourceItem&gt;
          {
              new SourceItem("Abigail"),
              new SourceItem("Bob"),
              new SourceItem("Cathy"),
              new SourceItem("David"),
              new SourceItem("Eugenie"),
              new SourceItem("Freddie"),
              new SourceItem("Greta"),
              new SourceItem("Harold"),
              new SourceItem("Irene"),
              new SourceItem("Jonathan"),
              new SourceItem("Kathy"),
              new SourceItem("Larry"),
              new SourceItem("Monica"),
              new SourceItem("Nick"),
              new SourceItem("Olive"),
              new SourceItem("Pendleton"),
              new SourceItem("Queenie"),
              new SourceItem("Rob"),
              new SourceItem("Sally"),
              new SourceItem("Timothy"),
              new SourceItem("Uma"),
              new SourceItem("Victor"),
              new SourceItem("Wendy"),
              new SourceItem("Xavier"),
              new SourceItem("Yvonne"),
              new SourceItem("Zachary")
          };
  
          // Create the ListView.
          ListView listView = new ListView
          {
              // Source of data items.
              ItemsSource = people,
              WidthRequest = 300,
              HeightRequest = 350,
  
              ItemTemplate = new DataTemplate(() =&gt;
                  {
                      // Create views with bindings for displaying each property.
                      Label ItemLabel = new Label();
                      ItemLabel.WidthRequest = 200;
                      ItemLabel.SetBinding(Label.TextProperty, "Item");
  
                      Image up = new Image();
                      up.Source = ImageSource.FromFile("up_arrow.png");
                      up.BackgroundColor = Color.Transparent;
                      up.WidthRequest = 25;
                      up.HeightRequest = 25;
  
                      Image down = new Image();
                      down.Source = ImageSource.FromFile("down_arrow.png");
                      down.BackgroundColor = Color.Transparent;
                      down.WidthRequest = 25;
                      down.HeightRequest = 25;
  
                      // Return an assembled ViewCell.
                      return new ViewCell
                      {
                          View = new StackLayout
                          {
                              Padding = new Thickness(0, 5),
                              Orientation = StackOrientation.Horizontal,
                              Children = 
                              {
                                  ItemLabel,
                                  up, down,
  
                              }
                              }
                      };
                  })
          };
  
          // Accomodate iPhone status bar.
          this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5);
  
          // Build the page.
          this.Content = new StackLayout
          {
              VerticalOptions = LayoutOptions.CenterAndExpand,
              HorizontalOptions = LayoutOptions.Center,
              Children = 
              {
                  listView
              }
              };
      }
  
  
  }
  }
  </code></pre>
  
  <p>Thanks in advance</p>