我试图用CarouselView类创建一个滑块,但我得到这个异常,我不知道为什么。
System.MissingMethodException = Method not found: void Xamarin.Forms.CarouselView.set_IndicatorView(Xamarin.Forms.IndicatorView).
我已经设置了 Forms.SetFlags("IndicatorView_Experimental")
在 MainActivity.cs
下面是代码。
<StackLayout>
<CarouselView x:Name="guidaView" IndicatorView="indicatorView" ItemsSource="{Binding Items}">
<CarouselView.ItemTemplate>
<DataTemplate>
<StackLayout>
<Label Text="{Binding Title}" FontSize="Large" FontAttributes="Bold"/>
<Label Text="{Binding Subtitle}" FontSize="Small" FontAttributes="Italic"/>
<Image Source="{Binding ImageSource}"/>
</StackLayout>
</DataTemplate>
</CarouselView.ItemTemplate>
</CarouselView>
<IndicatorView x:Name="indicatorView"
IndicatorsShape="Square"
IndicatorColor="LightGray"
SelectedIndicatorColor="DarkGray"
HorizontalOptions="Center"
Margin="0,0,0,40" />
</StackLayout>
我使用Xamarin.Forms(4.6.0.847版本)和Xamarin.Essentials(1.5.3.2)。
解决:在Project.Android中没有更新xamarin.forms包的版本。