Hello,
I´m testing CoverFlow but i transform the Bytes[] from database, to image with MemoryStream, BitmapImage etc...
But the images show a little seconds but after disappers, this is a CoverFlow problem or is my code?
I get an array of images in e.Result, this is a reply of webservice Async and my images are in jpg, all is correctly.
I´m testing CoverFlow but i transform the Bytes[] from database, to image with MemoryStream, BitmapImage etc...
But the images show a little seconds but after disappers, this is a CoverFlow problem or is my code?
//GLOBAL VARIABLES |
List<Byte[]> lB = new List<byte[]>(); |
List<Byte[]> lbuffer = new List<byte[]>(); |
ObservableCollection<Image> lI = new ObservableCollection<Image>(); |
List<MemoryStream> lMS = new List<MemoryStream>(); |
List<BitmapImage> lBM = new List<BitmapImage>(); |
Object o = new object(); |
void client_GetImagesSFCompleted(object sender, ImagesLibraryView.GetImages.GetImagesSFCompletedEventArgs e) |
{ |
o = e.Result.Clone(); |
foreach (Object img in (Object[])o) |
{ |
lB.Add((Byte[])img); |
} |
foreach (Byte[] bA in lB) |
{ |
MemoryStream mS = new MemoryStream(bA); |
mS.Write(bA, 0, bA.Length); |
lMS.Add(mS); |
} |
foreach (MemoryStream mS in lMS) |
{ |
BitmapImage imgBM = new BitmapImage(); |
imgBM.SetSource(mS); |
lBM.Add(imgBM); |
} |
foreach (BitmapImage bmI in lBM) |
{ |
Image I = new Image(); |
I.Width = 200; |
I.Height = 200; |
I.Stretch = Stretch.None; |
I.Source = bmI; |
lI.Add(I); |
} |
CoverFlow.ItemsSource = lI; |
} |
I get an array of images in e.Result, this is a reply of webservice Async and my images are in jpg, all is correctly.
15 Answers, 1 is accepted
0
Hello,
If RadCoverFlow is populated with Image elements, in order to provide loading animation, it attaches event handler on the ImageLoaded event of each image. I suppose that when the ImageSource is loaded from a MemoryStream, the ImageLoaded event is not fired, hence RadCoverFlow does not display the image. I would recommend trying to wrap each image in a Border - this will prevent RadCoverFlow from attaching handlers on those events and will display the images without loading animation. Other option would be to add the ImageSource objects to the ItemsSource collection of RadCoverFlow and provide a ItemTemplate, containing the data-bound image.
All the best,
Valeri Hristov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
If RadCoverFlow is populated with Image elements, in order to provide loading animation, it attaches event handler on the ImageLoaded event of each image. I suppose that when the ImageSource is loaded from a MemoryStream, the ImageLoaded event is not fired, hence RadCoverFlow does not display the image. I would recommend trying to wrap each image in a Border - this will prevent RadCoverFlow from attaching handlers on those events and will display the images without loading animation. Other option would be to add the ImageSource objects to the ItemsSource collection of RadCoverFlow and provide a ItemTemplate, containing the data-bound image.
All the best,
Valeri Hristov
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
phlogiston
Top achievements
Rank 1
answered on 12 Jan 2010, 04:27 PM
Hi,
I suppose i have an identical problem; my Images come as a list of Byte[] through WCF-Service.
I set them as source for MemoryStreams and those again as source for BitmapImages, who themselves become sources for Images,
obviously just like xax_007 did.
The control loads, i can see the pictures for a second, then it continues to show only the loading animation.
Besides you are right, Valeri, the ImageLoaded event never gets fired in this example.
As you suggested, i tried to wrap a border around any image, which had no effect...
Other option would be to add the ImageSource objects to the ItemsSource collection of RadCoverFlow and provide a ItemTemplate, containing the data-bound image.
I am very new to this, could you please explain that a bit further?
many thx in advance.
I suppose i have an identical problem; my Images come as a list of Byte[] through WCF-Service.
I set them as source for MemoryStreams and those again as source for BitmapImages, who themselves become sources for Images,
obviously just like xax_007 did.
The control loads, i can see the pictures for a second, then it continues to show only the loading animation.
Besides you are right, Valeri, the ImageLoaded event never gets fired in this example.
As you suggested, i tried to wrap a border around any image, which had no effect...
Other option would be to add the ImageSource objects to the ItemsSource collection of RadCoverFlow and provide a ItemTemplate, containing the data-bound image.
I am very new to this, could you please explain that a bit further?
many thx in advance.
0
phlogiston
Top achievements
Rank 1
answered on 13 Jan 2010, 08:47 AM
Thanks for any possible effort, but i was able to solve my problem.
It is now indeed working with the DataContext property set.
But anyway, i will stick to using the filepaths instead of Byte[]'s since loading would take too long.
best wishes!
It is now indeed working with the DataContext property set.
But anyway, i will stick to using the filepaths instead of Byte[]'s since loading would take too long.
best wishes!
0
this:
Other option would be to add the ImageSource objects to the ItemsSource collection of RadCoverFlow and provide a ItemTemplate, containing the data-bound image.
I think that can be a solution.
But finally I create image to directory of my IIS, and in coverflow in my list of items source binding a string url for image...
I don´t like this option because i have got to do a batch process for delete after the images..
Thanks phlogiston.
Salu2,
Pablo
Other option would be to add the ImageSource objects to the ItemsSource collection of RadCoverFlow and provide a ItemTemplate, containing the data-bound image.
I think that can be a solution.
But finally I create image to directory of my IIS, and in coverflow in my list of items source binding a string url for image...
I don´t like this option because i have got to do a batch process for delete after the images..
Thanks phlogiston.
Salu2,
Pablo
0
Helen
Top achievements
Rank 2
answered on 13 Feb 2010, 06:16 PM
Could you tell me how you got this to work?
I want to do the exact same thing.
Thanks a bunch,
Helen
I want to do the exact same thing.
Thanks a bunch,
Helen
0
0
phlogiston
Top achievements
Rank 1
answered on 15 Feb 2010, 07:35 AM
Hello Helen,
Here's an example of how i got CoverFlow to display my images:
XAML:
<telerikNavigation:RadCoverFlow x:Name="cfTest" ItemsSource="{Binding}" >
<telerikNavigation:RadCoverFlow.ItemTemplate>
<DataTemplate>
<Image Source="{Binding FullPath}" Width="350" Height="350" Stretch="Uniform" />
</DataTemplate>
</telerikNavigation:RadCoverFlow.ItemTemplate>
</telerikNavigation:RadCoverFlow>
and Code Behind:
// This is the Callback of my GetImages WCF-Service call
private void client_GetImagesCompleted(object sender, GetImagesCompletedEventArgs e)
{
cfTest.DataContext = e.Result;
}
In my case the Result here is a List of my custom Image-Class which consists only of the imagename and a property named FullPath, storing the absolute path to the image. In XAML you tell CoverFlow that the binding will follow at runtime, as well as which property of the binding will be the final imagesource.
As i have tested before, this works as well with Byte[]'s if you convert them to "Image" as Pablo has done.
Hope this is helpful; Best regards,
Phlogiston
Here's an example of how i got CoverFlow to display my images:
XAML:
<telerikNavigation:RadCoverFlow x:Name="cfTest" ItemsSource="{Binding}" >
<telerikNavigation:RadCoverFlow.ItemTemplate>
<DataTemplate>
<Image Source="{Binding FullPath}" Width="350" Height="350" Stretch="Uniform" />
</DataTemplate>
</telerikNavigation:RadCoverFlow.ItemTemplate>
</telerikNavigation:RadCoverFlow>
and Code Behind:
// This is the Callback of my GetImages WCF-Service call
private void client_GetImagesCompleted(object sender, GetImagesCompletedEventArgs e)
{
cfTest.DataContext = e.Result;
}
In my case the Result here is a List of my custom Image-Class which consists only of the imagename and a property named FullPath, storing the absolute path to the image. In XAML you tell CoverFlow that the binding will follow at runtime, as well as which property of the binding will be the final imagesource.
As i have tested before, this works as well with Byte[]'s if you convert them to "Image" as Pablo has done.
Hope this is helpful; Best regards,
Phlogiston
0
Helen
Top achievements
Rank 2
answered on 15 Feb 2010, 04:03 PM
Thank you, that makes perfect sense.
In my case I too get a byte array for the images, and that was the part I wanted to make sure it could handle.
Cheers,
Helen
In my case I too get a byte array for the images, and that was the part I wanted to make sure it could handle.
Cheers,
Helen
0
DragonBall
Top achievements
Rank 1
answered on 12 May 2010, 09:36 AM
<telerik:RadCoverFlow OffsetY="60" x:Name="CoverFlow1" ItemsSource="{Binding}" > |
<telerik:RadCoverFlow.ItemTemplate> |
<DataTemplate> |
<local:Cover Width="225" Height="225"></local:Cover> |
</DataTemplate> |
</telerik:RadCoverFlow.ItemTemplate> |
</telerik:RadCoverFlow> |
<Image x:Name="CoverFlowControl" Source="{Binding ImageSources}" Stretch="Fill" ImageFailed="Image_ImageFailed" telerikNavigation:RadCoverFlow.EnableLoadNotification="True" /> |
I am binding it though
this.DataContext = LocalHistoryCollection.HistoryCollection ; |
My class is
public class LocalHistoryCollection { public static List<LocalHistoryItem> HistoryCollection { get; set; } } public class LocalHistoryItem |
{ |
|
public BitmapImage ImageSources { get; set; } |
public string Title { get; set; } |
public int ThumbImageWidth { get; set; } |
public int ThumbImageHeight { get; set; } |
public string Description { get; set; } |
public LocalHistoryItem() |
{ |
ImageSources = new BitmapImage(); |
} |
} |
public BitmapImage GetHistoryImage(string filename) |
{ |
BitmapImage bi = new BitmapImage(); |
try |
{ |
using (var store = IsolatedStorageFile.GetUserStoreForApplication()) |
{ |
if (store.FileExists(string.Format("{0}.jpg", filename))) |
{ |
using (isoStream = store.OpenFile(string.Format("{0}.jpg", filename), FileMode.Open)) |
{ |
bi.SetSource(isoStream); |
return bi; |
} |
} |
} |
} |
catch (IsolatedStorageException ex) |
{ |
return bi; |
} |
return bi; |
} |
0
DragonBall
Top achievements
Rank 1
answered on 12 May 2010, 10:25 AM
problem solved i just remote the telerikNavigation:RadCoverFlow.EnableLoadNotification="True" from the Image control.
0
Daniela
Top achievements
Rank 1
answered on 16 Sep 2011, 03:31 PM
This solution did not work for me, can you please upload more from your code?
some help would be really appreciated,
kind regards,
some help would be really appreciated,
kind regards,
0
Daniela
Top achievements
Rank 1
answered on 16 Sep 2011, 03:32 PM
@phlogiston
This solution did not work for me, can you please upload more from your code?
some help would be really appreciated,
kind regards,
This solution did not work for me, can you please upload more from your code?
some help would be really appreciated,
kind regards,
0
Daniela
Top achievements
Rank 1
answered on 19 Sep 2011, 08:24 AM
does any one from telerik know the solution? any help would be very appreciated.
0
Hello Daniela,
Miroslav Nedyalkov
the Telerik team
We don't know what problem you are experiencing and without a project that demonstrates it, we are shooting in the dark. What I could suggest you is to try to load the images without a CoverFlow control - this could help you to isolate the problem you are experiencing. This post could be helpful.
Kind regards,Miroslav Nedyalkov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Daniela
Top achievements
Rank 1
answered on 28 Sep 2011, 03:12 PM
Hi,
thanks a lot for your reply, I could fix the error. I was not getting the correct image folder in the server. this is the code in case some one can use it:
FullPath = HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Host + ":" + HttpContext.Current.Request.Url.Port + "/imageFolderInTheServer/" + pictureName;
Kind Regards,
thanks a lot for your reply, I could fix the error. I was not getting the correct image folder in the server. this is the code in case some one can use it:
FullPath = HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Host + ":" + HttpContext.Current.Request.Url.Port + "/imageFolderInTheServer/" + pictureName;
Kind Regards,