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

export image to server

1 Answer 20 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Andrea
Top achievements
Rank 1
Andrea asked on 13 Dec 2011, 05:32 PM
Hi ,
 I am succesfully using your

Telerik.Windows.Media.Imaging.ExportExtensions.ExportToImage
to save on teh client machine a FrameworkElement.

Now I would like to send this image also to the server
To do so my idea is to cerate a new MemoryStream :
var stream = new MemoryStream();

Telerik.Windows.Media.Imaging.ExportExtensions.ExportToImage( element, stream,new PngBitmapEncoder())

and then put the memoryStream to a string and send teh string to the server using

WebClient.UploadStringAsync

the problem I have in this solution is that the MemoryStream returned by the ExportToImage is very short (81 bytes)  while I expect an image of around 24kb

have you faced this probolem before? do you have a solution?

 

 

 

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Bartholomeo Rocca
Top achievements
Rank 1
answered on 15 Dec 2011, 03:43 PM
Hello Andrea,

I have encountered something similar in one of my projects -- basically stream with length 81 bytes means that that the exported image is empty.
The problem in my application was related to the fact that I was trying to export chart instance that was not part of the visual tree (it was virtualized ListBox content) and this is not supported by the export-to-image functionality in Silverlight.


Greetings,
Bart.
Tags
Chart
Asked by
Andrea
Top achievements
Rank 1
Answers by
Bartholomeo Rocca
Top achievements
Rank 1
Share this question
or