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

Showing Camera Roll pictures

1 Answer 88 Views
DataBoundListBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
JDBPocketware
Top achievements
Rank 2
JDBPocketware asked on 03 Mar 2012, 05:43 PM
Hello

I am listing pictures from the phone's "camera roll", however it does not load async. When having more than 20 photos it lags about 3 seconds to then display all the pictures at once, items are not drawn progressively.

Load list:
var library = new MediaLibrary();
var photos = (from p in library.RootPictureAlbum.Albums[1].Pictures
                                select new ImageWrapper(p)).ToArray();
list.ItemsSource = photos;

ImageWrapper:
public class ImageWrapper{
    public Picture Picture { get; set; }
     public ImageWrapper(Picture picture){
        Picture = picture;
    } 
    public ImageSource Image{
        get{
            var image = new WriteableBitmap(100,100);
            image.SetSource(Picture.GetThumbnail());
            return image;
        }
    }
}

Xaml:
<telerikPrimitives:RadDataBoundListBox x:Name="list" ItemTemplate="{StaticResource itemTpl}" DataVirtualizationMode="Automatic">
<telerikPrimitives:RadDataBoundListBox.VirtualizationStrategyDefinition>
 <telerikPrimitives:WrapVirtualizationStrategyDefinition Orientation="Horizontal"/>
</telerikPrimitives:RadDataBoundListBox.VirtualizationStrategyDefinition>
</telerikPrimitives:RadDataBoundListBox>

I am using the latest 2012.1.301.2040 dev hotfix. I guess issue is the same as on this case.

1 Answer, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 06 Mar 2012, 03:25 PM
Hi Jandieg,

Thank you for your question.

If you want the items to be drawn progressively, you can set the IsAsyncBalanceEnabled property to true, which will cause each visual container to be realized asynchronously upon initial binding. You can read about Asynchronous Balance in our online documentation here.

I also noticed that you have set DataVirtualizationMode to Automatic, but it has no effect unless the itemsSource is of type VirtualizingDataCollection. You can read more about the data virtualization in RadDataBoundListBox here.

I hope this information helps. Let me know if you need additional assistance.

Kind regards,
Todor
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
DataBoundListBox
Asked by
JDBPocketware
Top achievements
Rank 2
Answers by
Todor
Telerik team
Share this question
or