Hi everybody,
I'm trying to bind the ItemSource property of a ListView that it's located in a ContentView.
Here is the XAML code of the ContentView:
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="App.Controls.CustomListView">
<ListView ItemsSource="{Binding ItemsSource}"/>
</ContentView>
The code behind of this control:
namespace App.Controls
{
public partial class CustomListView : ContentView
{
public CustomListView()
{
InitializeComponent();
}
/// <summary>
/// Identifies the ItemsSource attached property.
/// </summary>
public static readonly BindableProperty ItemsSourceProperty = BindableProperty.Create("ItemsSource", typeof(IEnumerable), typeof(CustomListView));
/// <summary>
/// Accessors
/// </summary>
public IEnumerable ItemsSource
{
get { return (IEnumerable)GetValue(ItemsSourceProperty); }
set
{
SetValue(ItemsSourceProperty, value);
}
}
}
}
Then I bind an ObservableCollection on this control like that:
<ctrl:CustomListView ItemsSource="{Binding List}" />
When the bound list is feeded, the ListView is not updated, does anyone have an idea of where the problem is located?
Thanks for your help!