Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

System.TypeInitializationException error with Carouselview

$
0
0

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);   
                }

Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>