Sorry *disappear
Hello! I'm using your amazing controls for my Windows Phone Application.
I need to download several images from Windows Phone Library and my code runs fine but the DataBoundListBox does not load the preview image of my collection of images.
I tried to use a standard ListBox and my collection is displayed correctly.
Could you help me?
I'm using RX Framework
XAML:
<telerikPrimitives:RadDataBoundListBox IsCheckModeActive="True" IsCheckModeEnabled="True" ItemsSource="{Binding Images}" ItemTemplate="{StaticResource MediaLbraryPictureItemTemplate}" ItemAnimationMode="PlayOnAdd" IsAsyncBalanceEnabled="True" CheckModeDeactivatedOnBackButton="False" >
<telerikPrimitives:RadDataBoundListBox.VirtualizationStrategyDefinition>
<telerikPrimitives:DynamicGridVirtualizationStrategyDefinition Orientation="Horizontal"/>
</telerikPrimitives:RadDataBoundListBox.VirtualizationStrategyDefinition>
</telerikPrimitives:RadDataBoundListBox>
C# Code
protected override async void OnActivate()
{
var synchContext = new SynchronizationContextScheduler(System.Threading.SynchronizationContext.Current);
library = new MediaLibrary();
CheckedImages = new ObservableCollection<object>();
Images = new ObservableCollection<Providers.Models.ImageItem>();
await Task.Delay(500);
library.Pictures.ToObservable()
.ObserveOn(synchContext)
.Subscribe(pic =>
{
try
{
BitmapImage bmp;
bmp = new BitmapImage();
var thumb = pic.GetThumbnail();
if (thumb != null)
{
bmp.CreateOptions = BitmapCreateOptions.None;
bmp.SetSource(thumb);
Providers.Models.ImageItem item = new Providers.Models.ImageItem
{
ID = pic.GetHashCode(),
Thumbnail = bmp
};
Images.Add(item);
thumb = null;
bmp = null;
Debug.WriteLine("ItemAdded");
}
}
catch (Exception ex)
{
var smsservice = IoC.Get<IMessageBoxService>();
var result = smsservice.Show("Sorry. Something happend wrong, Would you like to send us a report?", "ERROR", System.Windows.MessageBoxButton.OK);
if (result == System.Windows.MessageBoxResult.OK)
{
var reportservice = IoC.Get<IDeviceReportService>();
reportservice.showReport(ex);
}
}
});
base.OnActivate();
}