title: Binding Color in Xamarin listView
body: <p>I've checked some answers before but nothing helped me. I'm trying to change background color of ViewCell in ListView by binding StackLayout BackgroundColor.
  For now it looks like this<a href="https://i.stack.imgur.com/Dncce.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Dncce.png" alt="enter image description here"></a></p>
  
  <p>Every cell should be filled with different color but it does not change at all. Code behind it:</p>
  
  <p>OrderDatapage.XAML:</p>
  
  <pre><code>&lt;ContentPage.Resources&gt;
      &lt;ResourceDictionary&gt;
          &lt;local:BackgroundConverter x:Key="BackgroundConverter" /&gt;
      &lt;/ResourceDictionary&gt;
  &lt;/ContentPage.Resources&gt;
  .
  .
  .
  .
  &lt;StackLayout Orientation="Vertical"&gt;
         &lt;ListView x:Name="timetableList"
                          RowHeight="25"
                          SeparatorVisibility="Default"
                          Margin="0,0,0,10"
                          &gt;
                  &lt;ListView.ItemTemplate&gt;
                      &lt;DataTemplate&gt;
                          &lt;ViewCell&gt;
                              &lt;StackLayout Orientation="Horizontal"
                                          VerticalOptions="FillAndExpand"
                                          BackgroundColor="{Binding Paint, Converter={StaticResource BackgroundConverter}}"&gt;
                                          &lt;Label Text="{Binding Number}"
                                                  FontSize="Medium"
                                                  Margin="20,0,0,0"
                                                  TextColor="White"
                                                  BackgroundColor="Black"
                                                  /&gt;
                                          &lt;Label Text="{Binding Title}"
                                                  FontSize="Default"
                                                  Margin="20,0,0,0"
                                                  TextColor="Black"
                                                  /&gt;
                                          &lt;Label Text="{Binding Date}"
                                                  FontSize="Default"
                                                  HorizontalOptions="EndAndExpand"
                                                  Margin="0,0,40,0"
                                                  TextColor="Black"
                                                  /&gt;
                               &lt;/StackLayout&gt;
                          &lt;/ViewCell&gt;
                     &lt;/DataTemplate&gt;
                 &lt;/ListView.ItemTemplate&gt;
          &lt;/ListView&gt;
      &lt;/StackLayout&gt;
  </code></pre>
  
  <p>Converter.cs</p>
  
  <pre><code>class BackgroundConverter : IValueConverter
  {
      public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
      {
          return Color.FromHex(value.ToString());
      }
  }
  </code></pre>
  
  <p>OrderDataPage.cs</p>
  
  <pre><code>    List&lt;TimetableItem&gt; timeTableList { get; set; }
      public OrderDataPage()
      {
          InitializeComponent();
          timeTableList = new List&lt;TimetableItem&gt;();
          var timetable1 = new TimetableItem() { Number = "1", Title = "Test1", Date = "20-12-2020", Paint = "#63FF20" };
          var timetable2 = new TimetableItem() { Number = "2", Title = "Test2", Date = "20-12-2020", Paint = "#FFD933" };
          var timetable3 = new TimetableItem() { Number = "3", Title = "Test3", Date = "20-12-2020", Paint = "#C0C0C0" };
          timeTableList.Add(timetable1);
          timeTableList.Add(timetable2);
          timeTableList.Add(timetable3);
  
          timetableList.ItemsSource = timeTableList;
  
      }
  </code></pre>