.NET Framework Developer Center > .NET Development Forums > Windows Presentation Foundation (WPF) > Is there a way to convert a Canvas based visual element to a Drawing based one?
Ask a questionAsk a question
 

AnswerIs there a way to convert a Canvas based visual element to a Drawing based one?

  • Thursday, July 02, 2009 10:31 PMerick.thompson Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I have a number of Canvas based images that I would like to use in my application. The problem is, the system that I am using requires Drawing based images. It appears that for clip-art like images, the two have the same capabilities. Is there a way, either in code or a tool, to convert Canvas XAML to Drawing XAML?

    Thanks,
    Erick

Answers

  • Wednesday, July 08, 2009 10:09 PMmumin_abdul Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Maybe you can adapt this: http://www.ericsink.com/wpf3d/7_XAML.html

    So maybe you could take a screen capture and then you can process it.
    Algorithms, Mathematics, and Programming http://www.algomaths.com/forum

All Replies

  • Wednesday, July 08, 2009 7:34 AMBruce.ZhouMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi erick,

    Would you please elaborate the problem? Currently, I did not understand what you want.

    Best regards,
    Bruce Zhou
    Please mark the replies as answers if they help and unmark if they don't.
  • Wednesday, July 08, 2009 5:55 PMerick.thompson Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Bruce,

    Thanks for the response. Basically, I have XAML content that is expressed in terms of Canvases. A Canvas with contained Rectangles, Paths, sub-Canvases, etc. The Canvas works fine in an WPF window, but the 3rd party API that I am using requires that the content be contained within Drawings. What I was hoping is that there is a way to convert the Canvas based content to Drawing based content (i.e., DrawingGroup).

    I fully understand that there isn't 100% overlap between the two, but the XAML that I am working with could be expressed in either.

    Does that give you enough information?

    Thanks,
    Erick
  • Wednesday, July 08, 2009 10:09 PMmumin_abdul Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Maybe you can adapt this: http://www.ericsink.com/wpf3d/7_XAML.html

    So maybe you could take a screen capture and then you can process it.
    Algorithms, Mathematics, and Programming http://www.algomaths.com/forum
  • Thursday, July 09, 2009 1:34 AMerick.thompson Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks, I like the approach, and I believe that it should work.

    Erick