title: Xamarin.Forms iOS listview selected item color
body: <p>I need to change the selected item color of a listview in my Xamarin.Forms app.
  So I created a custom renderer...</p>
  
  <p>PCL C#:</p>
  
  <pre><code>public class DarkViewCell : ViewCell {}
  </code></pre>
  
  <p>PCL XAML:</p>
  
  <pre><code>&lt;ListView&gt;
    &lt;ListView.ItemTemplate&gt;
      &lt;DataTemplate&gt;
        &lt;local:DarkViewCell&gt;
          &lt;ViewCell.View&gt;
            ... Stuff ...
          &lt;/ViewCell.View&gt;
        &lt;/local:DarkViewCell&gt;            
      &lt;/DataTemplate&gt;
    &lt;/ListView.ItemTemplate&gt;
  &lt;/ListView&gt;
  </code></pre>
  
  <p>iOS</p>
  
  <pre><code>public class DarkViewCellRenderer : ViewCellRenderer
  {
      private UIView bgView;
  
      public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
      {
          var cell = base.GetCell(item, reusableCell, tv);
  
          cell.BackgroundColor = UIColor.Black;
          cell.TextLabel.TextColor = UIColor.White;
  
          if (bgView == null)
          {
              bgView = new UIView(cell.SelectedBackgroundView.Bounds);
              bgView.Layer.BackgroundColor = UIColor.FromRGB(48,48,48).CGColor;
              bgView.Layer.BorderColor = UIColor.FromRGB(48, 48, 48).CGColor;
              bgView.Layer.BorderWidth = 2.0f;
          }
  
          cell.SelectedBackgroundView = bgView;
  
          return cell;
      }
  }
  </code></pre>
  
  <p>But is not working. I also tried to change the SelectionStyle but nothing...</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>In a new project it works. And the code is the same</p>