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

Displaying images from the PhotoChooserTask

1 Answer 60 Views
SlideView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tim
Top achievements
Rank 1
Tim asked on 04 Feb 2012, 06:54 AM
In my scenario, users are able to take & attach pictures to an object in the UI without ever saving back to the database. I want to display these images in a RadSlideView without having to save them to the database or Isolated Storage. Based on the ImageSource class, it looks like I should be able to do this, but nothing seems to work.

void photoChooserTask_Completed(object sender, PhotoResult e)
{
    if (e.TaskResult != TaskResult.OK) { return; }
 
    byte[] photoData = new byte[e.ChosenPhoto.Length];
 
    e.ChosenPhoto.Read(photoData, 0, photoData.Length);
 
    BitmapImage image = new BitmapImage();
    image.SetSource(e.ChosenPhoto);
 
    ImageSource imageSource = image;
 
    this.slideView.DataContext = imageSource;
}
<telerikPrimitives:RadSlideView x:Name="slideView" Height="200" IsZoomedOut="True" Grid.Row="8">
    <telerikPrimitives:RadSlideView.ItemTemplate>
        <DataTemplate>
            <Image Source="{Binding Source}" />
        </DataTemplate>
    </telerikPrimitives:RadSlideView.ItemTemplate>
    <telerikPrimitives:RadSlideView.DataSource>
        <telerikPrimitives:SlideViewPictureSource ItemsSource="{Binding}" />
    </telerikPrimitives:RadSlideView.DataSource>
</telerikPrimitives:RadSlideView>

Unfortunately, nothing renders out. Any ideas?

1 Answer, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 08 Feb 2012, 10:14 AM
Hi Tim,

Thank you for contacting us and for your question.

Last week we released a BETA of our Q1 2012 release. We have re-designed the architecture of RadSlideView so that it can meet all the requirements we collected from our users. It now exposes API, similar to the one in our RadDataBoundListBox - there is an ItemsSource property, which you can specify directly. You can dynamically change the source collection and in case it is an ObservableCollection, changes will be handled automatically. Providing ImageSource directly should also work as it is natively supported by the Image control.

For more information you may see our documentation here.

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

Regards,
Georgi
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
SlideView
Asked by
Tim
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Share this question
or