BierDav
BierDav

Reputation: 1404

Is there a way to render svg files in UWP

I need to render complex svg files in my UWP application, but I haven't found any way to properly render a svg file from a path without using a WebView.

Is there a library which is able to do that? Moreover it would be great if it provides DataBinding.

With complex I mean every valid svg file should be able to render properly. e.g. a base64 encoded image within the svg file

Currently I use a WebView but there are a few caveats:

Upvotes: 0

Views: 1623

Answers (1)

Nico Zhu
Nico Zhu

Reputation: 32775

Is there a way to render svg files in UWP

Sure, please refer SvgImageSource document, it could used to render svg image file. You can define a SvgImageSource by using a Uniform Resource Identifier (URI) that references a SVG file.

For example

<Image
    Width="24"
    Height="24"
    Stretch="Fill">
    <Image.Source>
        <SvgImageSource  
            UriSource="/Assets/AddComment.svg" />
    </Image.Source>
</Image>

And you could also use Win2D library to render SVG file, this related care reply that you could refer to.

Upvotes: 1

Related Questions