Reputation: 416
I have an existing Xamarin Forms app and am trying to add a XAML page that contains a very simple CollectionView. The page throws exceptions in the Visual Studio renderer but displays just fine in the emulator. Here is the code (taken directly from the CollectionView documentation):
<ContentPage.Content>
<StackLayout>
<CollectionView>
<CollectionView.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Baboon</x:String>
<x:String>Capuchin Monkey</x:String>
<x:String>Blue Monkey</x:String>
<x:String>Squirrel Monkey</x:String>
<x:String>Golden Lion Tamarin</x:String>
<x:String>Howler Monkey</x:String>
<x:String>Japanese Macaque</x:String>
</x:Array>
</CollectionView.ItemsSource>
</CollectionView>
</StackLayout>
</ContentPage.Content>
</ContentPage>
Here is the exception that is thrown when I try to view the XAML page in the renderer:
The exception that appears to be relevant is in the CollectionViewRenderer.
I am using the latest update to Visual Studio 2019
And these are the installed Xamarin-related products:
No other XAML page throws exceptions in the renderer. It is only when I have added a CollectionView to the page.
Upvotes: 0
Views: 149
Reputation: 11
I would recommend avoiding the preview tool in visual studio and instead use the Hot Reload feature while running the app in the emulator to help build your UI's. Preview tool is notoriously buggy and generally will only work on very simple pages.
Upvotes: 1