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

[Solved] Urgent : Binding to an Images Collection

3 Answers 130 Views
CoverFlow
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
mohit
Top achievements
Rank 1
mohit asked on 20 Jan 2011, 07:50 PM

Hello,

Iam running into a major issue:

I have a coverflow:

 
<telerik:RadCoverFlow OffsetY="60" OffsetX="0" Opacity="0" Height="200"  ItemsSource="{Binding}"  x:Name="Cover" ReflectionHeight="0.25" >
               <telerik:RadCoverFlow.Resources>
                   <Style TargetType="telerik:RadCoverFlowItem">
                       <Setter Property="telerik:RadDragAndDropManager.AllowDrag" Value="True"></Setter>
                   </Style>
               </telerik:RadCoverFlow.Resources>
                
               <telerik:RadCoverFlow.ItemTemplate>
                   <DataTemplate x:Name="cfDataTemplate">
                       <Image Source="{Binding ObtainedImage}"  x:Name="cvrImage" Width="174" Height="230" Stretch="UniformToFill" telerik:RadCoverFlow.EnableLoadNotification="True" />
                   </DataTemplate>
               </telerik:RadCoverFlow.ItemTemplate>
                
           </telerik:RadCoverFlow>

and I have a ObservableCollection<Slide> AsthmaImages, where slide is an object that stores the following objects:

public class Slide
    {
        public Slide()
        {
           
            
        }

 
        public BitmapImage ObtainedBitmap { get; set; }
 
        public Image ObtainedImage { get; set; }
     
    }

Now Iam binding the observable collection to the cover flow by setting the item source property:

Cover.ItemSource = AsthmaImages;

But the images dont show up in the cover flow and it shows the loading rotator. I would like to add that these are in-memory images which are received through WCF services. I have tried the workarounds given in different threads but none of them seem to work. I know its not firind the loaded event thats why it shows that loader. Please help.

Thanks in advance

3 Answers, 1 is accepted

Sort by
0
Dani
Telerik team
answered on 26 Jan 2011, 08:46 AM
Hello Mohit,

The problem with your code is that you are assigning an object of type Image, namely ObtainedImage, to the property Image.Source. The Source of the Image should be of type Uri. I suggest you modify the ObtainedImage property in the following manner:

private Uri imageSource;
public Uri ImageSource
       {
           get { return imageSource; }
           set { imageSource = value; }
       }

One more issue - when you use ItemsSource="{Binding}" in XAML there is no need to do the same in the code-behind (Cover.ItemSource = AsthmaImages;). Just use the DataContext to grant access of the CoverFlow to the collection. You can see all this in action in the Gallery online example, for instance.


Regards,
Dani
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
mohit
Top achievements
Rank 1
answered on 26 Jan 2011, 01:54 PM
Hi Dani,

Thank you for your reply. Actually we can ignore the ObtainedURI as that is just the path of image on the live server as Iam getting the images through WCF services. Like I mentioned earlier they are In-Memory images which means Iam getting them as a stream and then converting them to bitmap and adding to an observable collection. I also tried setting setting the source property to ObtainedBitmap but it does the same thing. I also tried setting DataContext property but still shows the loaders.

Thank You
0
Dani
Telerik team
answered on 31 Jan 2011, 08:11 AM
Hi Mohit,

Please, check the CoverFlow DataBinding example. I believe it demonstrates just what you wish to achieve.  If it does not give you enough guidance, please send a sample project which reproduces the issue, so that  we are able to help you.

Greetings,
Dani
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Tags
CoverFlow
Asked by
mohit
Top achievements
Rank 1
Answers by
Dani
Telerik team
mohit
Top achievements
Rank 1
Share this question
or