This question is locked. New answers and comments are not allowed.
Hello,
I'm having trouble loading the images from an SQL 2008 database (saved as image) into the the coverflow.
None of the examples I have looked at show the correct way to do this within Lightswitch.
Since I am using Lightswitch I am usign an older version of the Telerik controls that still support Silverlight 4.
I have got the coverflow to display the correct data from the database however when trying to get the image to display the whole page breaks.
Below is the Relevant XAML: (with the Image section commented out as it breaks the project)
Here is the Converter being used:
Any help would be greatly appreciated. (even a link to a lightswitch project that does load images fro ma database)
Thank you for your time,
Miles Barnett
I'm having trouble loading the images from an SQL 2008 database (saved as image) into the the coverflow.
None of the examples I have looked at show the correct way to do this within Lightswitch.
Since I am using Lightswitch I am usign an older version of the Telerik controls that still support Silverlight 4.
I have got the coverflow to display the correct data from the database however when trying to get the image to display the whole page breaks.
Below is the Relevant XAML: (with the Image section commented out as it breaks the project)
<Grid x:Name="LayoutRoot" Background="White"> <telerik:RadCoverFlow ItemsSource="{Binding Screen.honorsStudents}" SelectedItem="{Binding Screen.honorsStudents.SelectedItem, Mode=TwoWay}"> <telerik:RadCoverFlow.ItemTemplate> <DataTemplate> <StackPanel Background="LightBlue" MinWidth="300" Orientation="Vertical"> <TextBlock Text="First Name:" /> <TextBlock Text="{Binding FirstName}" Margin="5" /> <TextBlock Text="Surname:" /> <TextBlock Text="{Binding SurName}" Margin="5" /> <TextBlock Text="Image:" /> <!--<Image Source="{Binding picture, Converter={StaticResource ImageConverter}}" />--> </StackPanel> </DataTemplate> </telerik:RadCoverFlow.ItemTemplate> </telerik:RadCoverFlow> </Grid>Here is the Converter being used:
public class ImageConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { BitmapImage img = new BitmapImage(); using (MemoryStream stream = new MemoryStream(value as byte[])) { img.SetSource(stream); } return img; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return null; } } }Any help would be greatly appreciated. (even a link to a lightswitch project that does load images fro ma database)
Thank you for your time,
Miles Barnett