Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using a SVG file for a background for a Windows Store app (Metro)

Tags:

c#

windows-8

xaml

I have a simple Windows Store app and i'd like to use a SVG image for the background. I've created one using Inkscape and added it to the Assets folder and checked it's set to Content.

For the XAML i have the following;

<Grid>
    <Grid.Background>
        <ImageBrush ImageSource="/Assets/Background.svg"/>
    </Grid.Background>

</Grid>

Nothing is being displayed, Am i doing something wrong or is not possible to use an SVG file?

like image 685
Nathan Avatar asked Dec 09 '12 15:12

Nathan


1 Answers

Not directly (see Image File Formats). There are however converters and other controls that would enable you to leverage SVG assets. A number of them convert the vector SVG format to the vector XAML format.

A Bing search for me yield the following (and more). Do note, however, these are not specifically Windows 8 focused and there are some XAML dialect differences from WPF and Silverlight. I've not used them specifically with Windows 8, so this is not an endorsemnent, but just a few options worth looking into.

Inkscape (includes a XAML export option)

SVGImage Control

SharpVectors

ViewerSvg

like image 75
Jim O'Neil Avatar answered Sep 29 '22 16:09

Jim O'Neil