Forum Libraries, Components, and Plugins

Smaller package & less work? => SVG!

Hi all,
i'm proud to present you a component to use SVG vector images in your iOS and Android apps. And next week in your Windows Phone 8.1 and XamForms apps.

Vector Images

Vector images are like text fonts: they resize to any size without any artifact at any resolution, they can have multiple colors and shades, and colors can be remapped easily to other colors (for "material design": buttons states, ...)

SVG files are easy to edit: they are text files. And imaging tools exists: free Inkscape, Illustrator, paint (joking;-) ...

The benefits are:

  • perfect images at any resolution
  • auto color remapping depending on image state (normal, selected)
  • less work for development and maintenability: use only one image for all sizes and resolutions
  • a smaller app, as a vector image is at least 50% smaller than its bitmap version.
  • smaller memory footprint, it sligthly uses the cpu instead. Tested on iphone 4!


Download it here, from xamarin studio, or from visual studio. Package name: XamSvg.

Hope you'll find it useful.


  • DemiVisionDemiVision USMember ✭✭✭

    This is exactly what I need. Looks very promising!!

    Any update on the Forms support?

    Also, I am trying to install the component in "Try" mode and am receiving the error as seen in the attached image. Any idea what I might be doing wrong? Thanks!

  • MichalAniskoMichalAnisko USMember ✭✭

    I tested it on Android (Samsung Galaxy Note GT-7000 - this is fast device).

    I used svg icon from XamSvg Android example (e.g. "bike.svg") and the loading time was very very long about 400-500 ms.
    I used XamSvg.SvgFactory.GetBitmap and XamSvg.SvgFactory.GetDrawable.

    When I loaded sample png icon in native way, the loading time was no more than 10 ms.

    Final conclusion:
    I would not reccoment this component because of it very poor performance during loading svg.

  • softlionsoftlion FRBeta ✭✭✭

    This is very strange, i tryed on Samsung S3 I9300, a "correct" device, and load time is around 1-10ms. Let me post some benchmarks.

  • MichalAniskoMichalAnisko USMember ✭✭

    Yes, this is strange - I launched XamSvg Demo once again and there was no poor loading ( image loaded in 10- 20 ms), but in my project this looks very bad.
    I loaded the same icon ('bike.svg') and loading time was 421 ms.
    I attached screen.

  • EmanueleSabettaEmanueleSabetta ITBeta ✭✭✭

    I would like to buy this library, because I use SVG for all my UI assets. But I tried it, and loading any asset of mine make the library to crash.

    For example, I tried to load the following svg buttons created by me in Inkscape:

    You can download the raw svg here:

    I've added it to the raw folder, and this is the error I get when I run it in the Android emulator:

    System.NullReferenceException: Object reference not set to an instance of an object
      at XamSvg.Internals.SVGGradient.buildSVGGradientStopsArrays () [0x00000] in <filename unknown>:0 
      at XamSvg.Internals.SVGGradient.createShader () [0x00000] in <filename unknown>:0 
      at XamSvg.Internals.SVGPaint.getGradientShader (System.String pGradientShaderID) [0x00000] in <filename unknown>:0 
      at XamSvg.Internals.SVGPaint.setColorProperties (XamSvg.Internals.SVGProperties pSVGProperties, Boolean pModeFill) [0x00000] in <filename unknown>:0 
      at XamSvg.Internals.SVGPaint.applyPaintProperties (XamSvg.Internals.SVGProperties pSVGProperties, Boolean pModeFill) [0x00000] in <filename unknown>:0 
      at XamSvg.Internals.SVGPaint.setFill (XamSvg.Internals.SVGProperties pSVGProperties) [0x00000] in <filename unknown>:0 
      at XamSvg.Internals.Utils.SVGRectParser.parse (XamSvg.Internals.SVGProperties pSVGProperties, Android.Graphics.Canvas pCanvas, XamSvg.Internals.SVGPaint pSVGPaint, Android.Graphics.RectF pRect) [0x00000] in <filename unknown>:0 
      at XamSvg.Internals.SVGHandler.parseRect (System.Collections.Generic.Dictionary`2 pAttributes) [0x00000] in <filename unknown>:0 
      at XamSvg.Internals.SVGHandler.startElement (System.String pLocalName, System.String pQualifiedName, System.Collections.Generic.Dictionary`2 pAttributes) [0x00000] in <filename unknown>:0 
      at XamSvg.Internals.SVGHandler.Parse (System.Xml.XmlReader reader, CancellationToken cancel) [0x00000] in <filename unknown>:0 
      at XamSvg.SVGParser.ParseSvgFromReader (System.IO.TextReader reader, ISvgColorMapper pSVGColorMapper, CancellationToken cancel) [0x00000] in <filename unknown>:0 

    Is your library unable to display my svg assets or there is another problem?

  • TheGX2TheGX2 USMember

    I tried to download the trial of this to test in a Xamarin Forms project and all that seems to be there is support for Xamarin Android only. Will there be a trial that will work in Xamarin Forms Shared Code?

Sign In or Register to comment.