This is a migrated thread and some comments may be shown as answers.

Listview in the SlideView Problem

3 Answers 115 Views
SlideView
This is a migrated thread and some comments may be shown as answers.
Yakup
Top achievements
Rank 1
Yakup asked on 21 Mar 2020, 09:57 AM

Hi

Listview in the SlideView not working.

Error;

Value cannot be null. 
Line 1

3 Answers, 1 is accepted

Sort by
0
Yakup
Top achievements
Rank 1
answered on 23 Mar 2020, 09:41 AM
0
Didi
Telerik team
answered on 23 Mar 2020, 03:02 PM

Hello Yakup,

Thank you for the provided file.

I have created a sample based on it and I reproduced the error Value cannot be null. Usually this error occurs when something in the XAML is incorrect. I have researched the case further and here is what I have found: The content inside the slideview pages is created on-demand. So the SlideView control does not have all pages created. When you try to add 2 contentviews with ListView and bindings, the pages are still not created from the SlideView and the Value cannot be null is thrown.  

Solution:  

I suggest you add separate contentview files for both ListView controls and add them to the SlideView control, for example:

<telerikPrimitives:RadSlideView x:Name="slideView">
    <telerikPrimitives:RadSlideView.ItemsSource>
        <x:Array Type="{x:Type ContentView}">
            <ContentView>
                <local:View1/>
            </ContentView>
            <ContentView>
                <local:View2/>
            </ContentView>
        </x:Array>
    </telerikPrimitives:RadSlideView.ItemsSource>
</telerikPrimitives:RadSlideView>

and the View1.xaml file:


  <ContentView.Content>
        <ListView ItemsSource="{Binding Items}" x:Name="listView" Margin="30, 0">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell>
                        <Grid>
                            <Label Text="{Binding Title}" FontSize="13" FontAttributes="Italic" TextColor="Gray" Grid.Column="1"/>
                        </Grid>
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
    </ContentView.Content>

I hope this will help.

Regards,
Didi
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Yakup
Top achievements
Rank 1
answered on 25 Mar 2020, 10:01 AM

Hi Didi, 

Thank you for your answer.

Tags
SlideView
Asked by
Yakup
Top achievements
Rank 1
Answers by
Yakup
Top achievements
Rank 1
Didi
Telerik team
Share this question
or