This is a migrated thread and some comments may be shown as answers.
Virtualized datasource
3 Answers 63 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Andrew
Top achievements
Rank 2
Andrew asked on 19 Dec 2011, 10:37 PM
I haven't played with this control much but when I tried I wasn't able to achieve my goal. Am I able to set up an infinite virtual datasource for the control? What I would like to do is a gallery of online images and as the user swipes through them it pulls the next image from online. For my data I would prefer to use an observablecollection which would be used as the datasource for the control. Is any of this possible or on the road map?

Robert

3 Answers, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 20 Dec 2011, 10:29 AM
Hi Robert,

Thank you for contacting us and for your question.

RadSlideView inherits RadLoopingList and it is fully virtualized both in terms of UI and Data. The scenario with a gallery displaying online images should be easily implemented as the Silverlight framework itself handles image download and processing asynchronously and all you need to do is specify a valid URI. Here is a sample code:

private void SetupSlideView()
{
    // create a datasource with a virtual count of 100 000 to simulate infinite source
    int count = 100000;
    LoopingListDataSource source = new LoopingListDataSource(count);
    source.ItemNeeded += ((sender, e) =>
        {
            e.Item = new PictureDataItem();
        });
    source.ItemUpdated += ((sender, e) =>
    {
        (e.Item as PictureDataItem).Source = new Uri(this.pictures[e.Index % this.pictures.Length], UriKind.Absolute);
    });
 
    this.slideView.DataSource = source;
    this.slideView.IsLoopingEnabled = false;
}

Depending on the logical index you may dynamically build the URI and pass it as a Source property of the provided data item.

And we need to specify proper ItemTemplate to display the image:

<telerik:RadSlideView.ItemTemplate>
    <DataTemplate>
        <Image Source="{Binding Source}" Stretch="Uniform"/>
    </DataTemplate>
</telerik:RadSlideView.ItemTemplate>

We will think of a more generic data virtualization mechanism where you will be able to receive additional event - e.g. NewDataNeeded which will allow you to retrieve new data dynamically and to change the virtualized Count property of the data source depending on the downloaded data.

Another solution would be to use the predefined SlideViewPictureSource where you can specify a collection of URIs/strings to download images from. Here is a sample code:

<telerik:RadSlideView x:Name="slideView">
    <telerik:RadSlideView.DataSource>
        <telerik:SlideViewPictureSource ItemsSource="{Binding Pictures}"/>
    </telerik:RadSlideView.DataSource>
</telerik:RadSlideView>

I hope this helps. Let me know if I can assist you further.

All the best,
Georgi
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Andrew
Top achievements
Rank 2
answered on 20 Dec 2011, 02:20 PM
This doesn't really do what I was hoping. What I would expect is that slideview/radlooplist inherit from raddataboundlistbox and work the same with the exception that you could make it loop when DataVirtualizationMode is None. The control as it is now isn't useful for generic scenarios, only when you know the exact data you plan to display.

Robert
0
Victor
Telerik team
answered on 23 Dec 2011, 04:06 PM
Hi Robert,

 As Georgi explained, RadSlideView currently does not support on-demand data out of the box. We will consider implementing this feature in a future release.

Thank you for the feedback and let us know if you have other questions.

Regards,
Victor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
SlideView
Asked by
Andrew
Top achievements
Rank 2
Answers by
Georgi
Telerik team
Andrew
Top achievements
Rank 2
Victor
Telerik team
Share this question
or