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

Databind image source with RIA Services

1 Answer 77 Views
CoverFlow
This is a migrated thread and some comments may be shown as answers.
Rick Mueller
Top achievements
Rank 1
Rick Mueller asked on 14 Jan 2011, 06:46 AM
I have a Coverflow control binded to basic Northwind category table with 8 images.
I have btyes[] text appear instead of image, I pass the binding thru a converter and the IE crashes on debugging
Please any thoughts?
<navigation:Page.Resources>
       <local:ImageConverter x:Key="ImgCon"/>
   </navigation:Page.Resources>
<telerik:RadCoverFlow DisplayMemberPath="Picture" ItemsSource="{Binding ElementName=categoryDomainDataSource, Path=Data}" >
                               <telerik:RadCoverFlow.ItemTemplate>
                                   <DataTemplate>
                               <Border>
                                           <Image Source="{Binding Picture, Converter={StaticResource ImgCon}}"  telerik:RadCoverFlow.EnableLoadNotification="True" />
                               </Border>
                                   </DataTemplate>
                               </telerik:RadCoverFlow.ItemTemplate>
                           </telerik:RadCoverFlow>
  my Ria Service Source
<riaControls:DomainDataSource AutoLoad="True" d:DesignData="{d:DesignInstance my1:Category, CreateList=true}" Height="0" LoadedData="categoryDomainDataSource_LoadedData" Name="categoryDomainDataSource" QueryName="GetCategoriesQuery" >
            <riaControls:DomainDataSource.DomainContext>
                <my1:RecipeContext />
            </riaControls:DomainDataSource.DomainContext>
        </riaControls:DomainDataSource>
Converter
public class ImageConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            BitmapImage bmi = new BitmapImage();
            if (value != null)
            {
                byte[] byteBlob = value as byte[];
                MemoryStream ms = new MemoryStream(byteBlob);
                bmi.SetSource(ms);
            }
  
            return bmi;
        }
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
  regards,
Rick

1 Answer, 1 is accepted

Sort by
0
Kaloyan
Telerik team
answered on 19 Jan 2011, 02:29 PM
Hi Rick,

Can you attach all of the visual studio exceptions and try loading the example again. Hope that the error will appear this time with some more meaningful description as we are not able to determine the problem with the code you have send us.

All the best,
Kaloyan
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
Rick Mueller
Top achievements
Rank 1
Answers by
Kaloyan
Telerik team
Share this question
or