How to save my drawing screen as image.
-
Wednesday, April 11, 2012 10:00 AM
i am implementing drawing app using metro style xaml and C#.
how to save my drawing as a image.
All Replies
-
Wednesday, April 11, 2012 9:15 PMModerator
How are you creating your drawing? What do you mean by saving the drawing as an Image?
Are you drawing in a WriteableBitmap and want to save that out to a file? If so, this can be done with the BitmapEncoder class.
Are you creating the drawing out of Xaml elements and want to render the elements into a bitmap? If so then there is no way to do that. Windows.UI.Xaml doesn't provide any way to render Xaml elements into bitmaps.
--Rob
-
Saturday, April 14, 2012 8:59 AM
thanks rob,I have drawn some shapes and images using metro style C# XAML Control, now i want to share this drawing to facebook.is it possible.
and please provide other way to save my drawing in a drive.
-
Saturday, April 14, 2012 8:51 PMModerator
Hi Subbu,
There is no way to render Xaml elements to a bitmap. You would need to implement your own lower level drawing in order to create a bitmap you could share.
--Rob
- Marked As Answer by Rob CaplanMicrosoft Employee, Moderator Monday, April 16, 2012 11:57 PM
-
Sunday, April 15, 2012 1:10 PM
Hi Rob,
You mean we need to use directX.
Basicaliy we are rendring images, text and some basic shapes on canvas(XAML). please address the suitable techology for my app so i can easily save and share my app. Presentily i am using Metro style XAML C#.
Thanks,
//Subbu
-
Sunday, April 15, 2012 5:58 PMModerator
Either Direct2D or HTML/Canvas would work well for that.
Depending on the specifics, you could use a Xaml WriteableBitmap; however, you would need to implement your own lower level drawing to generate the text and basic shapes. Interop with Direct2D would be a good solution for that. I believe there are some 3rd party drawing controls being written to do this.
--Rob
- Marked As Answer by Rob CaplanMicrosoft Employee, Moderator Monday, April 16, 2012 11:57 PM
-
Tuesday, April 17, 2012 4:42 PM
Hi Rob,
If possible please pass some sample code or any related URLs for better understanding on this type situations.
Regards & Thanks,
Subbu
-
Tuesday, April 17, 2012 7:13 PMModerator
Hi Subbu,
This is a very broad question. You will need to your own research on what is available to see what matches your specific needs the best. Since this cannot be done directly in Xaml you will need to choose another technology or write some custom code.
Using graphics with canvas, SVG, and CSS3
Direct2D
DirectX and XAML interopBased on your questions I suspect you'll be best off either rewriting your app in HTML/JavaScript or using a 3rd party drawing library in the Xaml app. I know some such libraries are being worked on, but I don't know if any are complete and available.
--Rob
-
Sunday, June 24, 2012 5:40 PM
Hi Rob,
Is it possible to save render Xaml elements to a bitmap in release preview.
please address this issue.
//subbu
-
Monday, June 25, 2012 5:48 PMModerator
There are no changes to this in the Release Preview.
-
Monday, June 25, 2012 8:18 PMAn idea is to make a printscreen and crop the image. This solution is available only if your drawing surface has a fixed size and is always visible.
http://wyrdaprogramming.eu
-
Tuesday, June 26, 2012 6:18 AM
i am not able to access this url.
please let me know if you have any approach.
-
Tuesday, June 26, 2012 9:59 AMThat is my old signature. Sorry for confusion.
- Edited by wyrda Tuesday, June 26, 2012 9:59 AM
-
Saturday, September 08, 2012 9:13 AM
Any updates on the above issue.
-
Monday, September 10, 2012 10:53 PMModerator
The previous answers are still correct. You will need to render your image directly into a bitmap. You cannot render Xaml elements into a bitmap.
--Rob


