AndreiMisiukevich / CardView

CardsView | CarouselView | CoverflowView | CubeView for Xamarin.Forms
MIT License
710 stars 114 forks source link

CollectionView in CardsView Error #397

Closed JohannKatzendorn closed 3 years ago

JohannKatzendorn commented 3 years ago

Hi,

I get an XAML-Error if I try to work with a CollectionView in a CardView like this:

XAML Error: The value should not be NULL. Parametername : fieldType

What I am doing wrong?

<cards:CardsView Grid.Row="1" Grid.ColumnSpan="2" IsCyclical="False" IsClippedToBounds="True">
            <cards:CardsView.ItemsSource>
                <x:Array Type="{x:Type View}">

                    <CollectionView ItemsSource="{Binding Path=OutSerialList}">
                        <CollectionView.ItemTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="50" />
                                    </Grid.ColumnDefinitions>
                                    <StackLayout Margin="10" Orientation="Horizontal">
                                        <Label Text="{Binding SerialNumber}" VerticalTextAlignment="Center"
                                            LineBreakMode="NoWrap"
                                            FontSize="16" />
                                        <Button Text="+"
                                            Command="{Binding AddToOut}"        
                                            CommandParameter="{Binding .}"></Button>
                                    </StackLayout>
                                </Grid>
                            </DataTemplate>
                        </CollectionView.ItemTemplate>
                    </CollectionView>
AndreiMisiukevich commented 3 years ago

Hi All looks ok, I think it can be XF xaml parsing bug

Try to change cardsview to XF carouselview

JohannKatzendorn commented 3 years ago

Same error with the XF carousselview.

AndreiMisiukevich commented 3 years ago

Then it's definitely a Xamarin forms bug

You can add views from code behind

AndreiMisiukevich commented 3 years ago

Also, you can try to move the collection view to a separate file and refer it as a custom control https://stackoverflow.com/questions/51562832/value-cannot-be-null-parameter-name-fieldtype

Closing it as it's not related to CardsView

JohannKatzendorn commented 3 years ago

It works if I move the code out in a custom control.

Thanks.