locked
How to set a SVG as a background in a my metro App?

    Question

  • Hey there, 

    1 hour now I'm looking for a way to set a svg image file as a background of my page / main grid in my windows 8 metro application.

    I know how to retrieve the Data from a Svg file (and use it in a canvas), but it seems I can't set a canvas (where I could put my svg code) into the Grid.Background element.

    Is there a proper way to do it?

    Thanks a lot.

    Tuesday, July 22, 2014 9:00 AM

Answers

  • Change the grid to a canvas, add in your SVG, and put a new grid on top of the canvas for the rest of your controls.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    • Marked as answer by T.Dupuis Tuesday, July 22, 2014 12:50 PM
    Tuesday, July 22, 2014 12:23 PM
    Moderator

All replies

  • Change the grid to a canvas, add in your SVG, and put a new grid on top of the canvas for the rest of your controls.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    • Marked as answer by T.Dupuis Tuesday, July 22, 2014 12:50 PM
    Tuesday, July 22, 2014 12:23 PM
    Moderator
  • Ok I see, thanks!

    My svg looks centered in Visual Studio but not in the emulator now. But that's an other problem.

    Have a good day Matt Small!

    Tuesday, July 22, 2014 12:50 PM