'The CarouselView in Xamarin is broken. Anyone know how to fix this or report it?
I have a Picker that is part of a CarouselView. When the Picker appears in a CarouselView, it appears to selects a size proportional to all the items in the ItemsSource, like a list box, and not the size of a single unit, as you'd expect in a Picker (drop down).
This illustrates the issue. The Pickers are identical. Both sit inside a StackLayout. One is not inside a Carousel, the other is:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="App1.MainPage">
<StackLayout>
<Picker>
<Picker.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>California</x:String>
<x:String>Texas</x:String>
<x:String>New York</x:String>
<x:String>Arizona</x:String>
<x:String>Alabama</x:String>
</x:Array>
</Picker.ItemsSource>
</Picker>
<CarouselView Margin="20,5" IsBounceEnabled="False" Loop="False">
<CarouselView.ItemTemplate>
<DataTemplate x:DataType="viewModels:PageViewModel">
<StackLayout>
<Picker>
<Picker.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>California</x:String>
<x:String>Texas</x:String>
<x:String>New York</x:String>
<x:String>Arizona</x:String>
<x:String>Alabama</x:String>
</x:Array>
</Picker.ItemsSource>
</Picker>
</StackLayout>
</DataTemplate>
</CarouselView.ItemTemplate>
<CarouselView.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Do Nothing</x:String>
</x:Array>
</CarouselView.ItemsSource>
</CarouselView>
</StackLayout>
The result looks likes this:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

