Large number of big images

3 posts, 0 answers
  1. Martin
    Martin avatar
    6 posts
    Member since:
    Apr 2009

    Posted 09 Feb 2012 Link to this post

    Hello,

    I try to display a large number (about 100) of big images (each about 1MB). The images are stored in the IsolatedStorage of the Device. If I added them direct to the project and add a list of Uris, the control works perfect.

    But If I try to get the images from the storage I have some problems. If I use a BitmapImage Array as DataSource, where the files created out of an IsolatedStorageFileStream, I get of course an OutOfMemoryException.

    If I try to use an LoopingListDataSource no images are displayed. My code looks like this:
    var source = new LoopingListDataSource(numberOfImages);
    source.ItemNeeded += ((sender, e) =>
    {
        e.Item = new PictureDataItem();
    });
     
    source.ItemUpdated += ((sender, e) =>
    {
        var bitmap = new BitmapImage();
        using(var stream = Storage.GetFileStream(String.Format("{0}.jpg", (e.Index+1))))
        {
            bitmap.SetSource(stream);
        }
     
        var picture = e.Item as PictureDataItem;
        if (picture == null)
            return;
     
        picture.Source = bitmap;
    });
    _slideView.DataSource = source;

    Which options does I have to realize my scenario?

    Thanks in advance!
  2. Martin
    Martin avatar
    6 posts
    Member since:
    Apr 2009

    Posted 10 Feb 2012 Link to this post

    Hello,

    I solve my problem. I need to define an own ItemTemplate

    <telerikPrimitives:RadSlideView x:Name="_imageView" AllowZoomOut="False">
        <telerikPrimitives:RadSlideView.ItemTemplate>
            <DataTemplate>
                <slideView:PanAndZoomImage Source="{Binding Source}" />
            </DataTemplate>
        </telerikPrimitives:RadSlideView.ItemTemplate>
    </telerikPrimitives:RadSlideView>
  3. DevCraft banner
  4. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 10 Feb 2012 Link to this post

    Hello Martin,

    It's good that you've managed to resolve your case by yourself.

    We will consider this thread closed for now.

    Do not hesitate to get back to us in case you have further questions or need assistance.

    Regards,
    Deyan
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top