I am trying to retrieve the Items
from my nested ListView
from a tap gesture.
private void TapGestureRecognizer_Tapped(object sender, EventArgs e)
{
var source = ItemsCollectionView.ItemsSource as ObservableCollection<TableDataGroupDel>;
Debug.WriteLine("Items count: " + (source[0].Items as ObservableCollection<TableDataItemDel>).Count);
}
This is my constructor:
public class TableDataGroupDel : ObservableCollection<TableDataItemDel>
{
public TableDataGroupDel(string rayon, ObservableCollection<TableDataItemDel> animals) : base(animals)
{
this.Rayon = rayon;
this.Items = new ObservableCollection<TableDataItemDel>();
}
public string Rayon { get; private set; }
public new ObservableCollection<TableDataItemDel> Items { get; set; }
}
I am casting it to ObservableCollection<TableDataItemDel>
but it doesn't seem to work.
A source.Count
gives me a value
of 1 which means my List
isn't empty
and I can even get the Rayon
out of it. I can't seem to be able to get the Items
and I can't work it out why?
Any help is appreciated.
Edit: I can access the Items
throu .SelectedItem