Hi.
I tried create custom ItemsViewController, but I get an error when calling base.OnElementChanged(e):
System.InvalidCastException: Specified cast is not valid.
at Xamarin.Forms.Platform.iOS.SelectableItemsViewRenderer.get_SelectableItemsViewController () [0x00000] in D :\a\1\s\Xamarin.Forms.Platform.iOS\CollectionView\SelectableItemsViewRenderer.cs:9
at Xamarin.Forms.Platform.iOS.SelectableItemsViewRenderer.SetUpNewElement (Xamarin.Forms.ItemsView newElement) [0x00035] in D :\a\1\s\Xamarin.Forms.Platform.iOS\CollectionView\SelectableItemsViewRenderer.cs:44
at Xamarin.Forms.Platform.iOS.ItemsViewRenderer.OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs`1[TElement] e) [0x0000c] in D :\a\1\s\Xamarin.Forms.Platform.iOS\CollectionView\ItemsViewRenderer.cs:29
My code:
public class CustomCollectionViewRenderer: CollectionViewRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<ItemsView> e)
{
base.OnElementChanged(e);
if (Control == null)
return;
}
protected override ItemsViewController CreateController(ItemsView itemsView, ItemsViewLayout layout)
{
return new CustomCollectionViewController(itemsView, layout);
}
public class CustomCollectionViewController : ItemsViewController
{
public CustomCollectionViewController(ItemsView itemsView, ItemsViewLayout itemsViewLayout): base(itemsView, itemsViewLayout)
{
}
}
}
what am I doing wrong?