Urgent : Binding to an Images Collection

4 posts, 0 answers
  1. mohit
    mohit avatar
    3 posts
    Member since:
    Jun 2010

    Posted 20 Jan 2011 Link to this post

    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
  2. Dani
    Admin
    Dani avatar
    848 posts

    Posted 26 Jan 2011 Link to this post

    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>>
  3. DevCraft banner
  4. mohit
    mohit avatar
    3 posts
    Member since:
    Jun 2010

    Posted 26 Jan 2011 Link to this post

    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
  5. Dani
    Admin
    Dani avatar
    848 posts

    Posted 31 Jan 2011 Link to this post

    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>>
Back to Top