SuperJMN
SuperJMN

Reputation: 13972

Image with SVG file in UWP doesn't render correctly

I've tried to load some SVG files with the same result: they're rendering clipped and they seem to ignore the layout.

For instance:

<UserControl
    x:Class="SuppaFlight.UWP.AnglesControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300"
    d:DesignWidth="1000">

    <Image Source="Assets/treeicon.svg" Stretch="UniformToFill" />            

</UserControl>

Renders like this, ignoring the Stretch setting:

enter image description here

What's going on there? Is it a known problem? How to workaround this?

Upvotes: 1

Views: 1694

Answers (2)

Harsh Uppal.
Harsh Uppal.

Reputation: 26

Try to convert your SVG image into PNG or some other format online Website to Convert SVG to PNG

Upvotes: 0

Ahmed.Net
Ahmed.Net

Reputation: 186

  • Open the svg image in the editor
  • delete the width and height properties.
  • add viewbox="0 0 15 15". 15 is the value of the deleted width and height.
  • add width and height properties to image tag in xaml as desired.

these steps solved my issue, may be will help you

Upvotes: 1

Related Questions