Hi I suddenly get this error: "The type initializer for 'Xamarin.Forms.ItemsView' threw an exception." but this code worked fine before. I have no idea why it dosn't work anymore.
My code, error is thrown at this line "carouselview = new CarouselView()":
// --------- ShowMore functions ----------
CarouselView carouselview;
void setShowMore() {
showMoreTitle.Text = choosenEO.subPages[showMoreCounter].title;
showMoreContent.Text = choosenEO.subPages[showMoreCounter].text;
this.Images.Clear();
this.Images = new ObservableCollection<Img>();
svHolder.Children.Clear();
DataTemplate template = new DataTemplate(() =>
{
StackLayout st = new StackLayout() {
HorizontalOptions = LayoutOptions.Fill,
VerticalOptions = LayoutOptions.Fill
};
Image image = new Image();
image.Aspect = Aspect.AspectFit;
image.SetBinding(Image.SourceProperty, "src");
st.Children.Add(image);
return st;
});
carouselview = new CarouselView()
{
HeightRequest = 600,
ItemsSource = this.Images,
ItemTemplate = template
};
svHolder.Children.Add(carouselview);
}