【问题标题】:System.TypeInitializationException Xamarin CarouselViewSystem.TypeInitializationException Xamarin CarouselView
【发布时间】:2019-10-07 11:50:56
【问题描述】:

“Xamarin.Forms.ItemsView”的类型初始化程序引发异常。点击按钮后。

未处理的异常:

System.TypeInitializationException:“Xamarin.Forms.ItemsView”的类型初始化程序引发了异常。发生了

`<CarouselView>
                    <CarouselView.ItemsSource>
                        <x:Array Type="{x:Type View}">
                            <ContentView>
                                <Image Source="yuzon.jpg"/>
                            </ContentView>
                            <ContentView>
                                <Image Source="yuzyirmi.jpg"/>
                            </ContentView>
                            <ContentView>
                                <Image Source="yuzkirks.jpg" />
                            </ContentView>
                            <Image Source="yuzelli.jpg" />
                            <ContentView>
                                <Image Source="yuzaltmis.jpg" />
                            </ContentView>
                            <ContentView>
                                <Image Source="ikiyuzyirmi.jpg"/>
                            </ContentView>
                            <ContentView>
                                <Image Source="ikiyuzkirkC.jpg" />
                            </ContentView>
                            <ContentView>
                                <Image Source="ikiyuzyetmis.jpg" />
                            </ContentView>
                            <Image Source="ucyuz.jpg"  />
                            <ContentView>
                                <Image Source="ucyuzF.jpg"  />
                            </ContentView>
                            <ContentView>
                                <Image Source="ucyuzon.jpg" />
                            </ContentView>
                            <ContentView>
                                <Image Source="ucyuzotuz.jpg"  />
                            </ContentView>
                            <ContentView>
                                <Image Source="ucyuzaltmis.jpg"  />
                            </ContentView>
                        </x:Array>
                    </CarouselView.ItemsSource>
                </CarouselView>` 

【问题讨论】:

    标签: xaml xamarin carousel


    【解决方案1】:

    此控件属于 Xamarin.Forms 4.0。因此,您必须将表单版本更新到 4.0 才能测试此新功能。

    此外,您必须在 MainActivity.cs 和 AppDelegate 中添加
    global::Xamarin.Forms.Forms.SetFlags("CollectionView_Experimental"); 才能启用此测试。

    很遗憾,轮播视图只能在 Android 上使用:https://github.com/pauldipietro/CollectionViewSample。

    关注此博客以了解更多概念:https://devblogs.microsoft.com/xamarin/xamarin-forms-4-0-feature-preview-an-entirely-new-point-of-collectionview/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-25
      • 2018-12-15
      • 1970-01-01
      相关资源
      最近更新 更多