We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Draw chart on WriteableBitmap with background agent

Hi,

I want to create a live tile with a line graph on it, so my App has a background agent to draw UserControl with SfChart on a WriteableBitmap, and then show the image on live tile.

Code Example:
MyChartUserControl uc = new MyChartUserControl();
WriteableBitmap wbmp = new WriteableBitmap(691, 336);
wbmp.Render(uc, null);
wbmp.Invalidate();

using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
            {
                using (IsolatedStorageFileStream imageStream = new IsolatedStorageFileStream(TILE_IMAGE_PATH, System.IO.FileMode.Create, isf))
                {
                    wbmp.SaveJpeg(imageStream, wbmp.PixelWidth, wbmp.PixelHeight, 0, 100);
                }
            }
// Update tile image
// .......

However, if draw line chart on WriteableBitmap with background agent, the line disappears (Please refer to the attached). And if add line chart to PhoneApplicationPage of my App, it draws correctly.

May I know how to draw a line chart on WriteableBitmap with background agent?
Thanks.

Attachment: tile01_42dd639e.zip

3 Replies

MA Mohammed Azarudeen Syncfusion Team June 30, 2014 12:52 PM UTC

Hi Peni,

We have analyzed the reported issue and we are unable to reproduce the issue. Can you please check with the sample in the following location? If still you face the problem, please revert us by modifying the sample based on your application along with replication procedure. This would be helpful for us to serve you.

Please let us know if you have any queries.

Thanks,

Mohammed Azarudeen.


Attachment: WritableBitmapDemo_aa65347f.zip


PE Peni June 30, 2014 05:19 PM UTC

Hi,

I had updated the sample code.

Main changes:
1. There is a scheduled task to draw chart from background agent, not foreground application.
2. ChartUserControl is in class library project, not application project.

The result image is img2.jpg.


Thank you.

Attachment: WritableBitmapDemo_5201b174.zip


SS Sheik Syed Abthaheer M Syncfusion Team July 3, 2014 10:22 AM UTC

Hi Peni,

 

Thanks for your update.

 

We have analyzed the reported issue and we could not find the issue in our control. We suspect that, the issue may be framework issue.   The Item source does not bind while bitmap renders the new instance of User Control.  We have modified your code with Microsoft control and able to reproduce the issue with Microsoft control. Please find the sample in the below location.

Please let us know if you require further assistance on this.

 

Regards,

M. Sheik


Attachment: WritableBitmapDemo_50cd7faf.zip

Loader.
Live Chat Icon For mobile
Up arrow icon