This project has moved and is read-only. For the latest updates, please go here.

Dynamic property changes to an SVG which is loaded already

Topics: SVG, SVG# and Parsing
Oct 24, 2011 at 12:09 PM


We would like to know the possibility to change some properties of the SVG file/document loaded to the viewer usings this framework. 


> SVG gets loaded. 

> Based of some data , we like to change the color (fills, border etc) for few elements (rectangle, circle etc)

> Need to embed small images/svg to the current SVG document. 

> After attributes are modified, the SVG should get refreshed without reloading the entire SVG. 

Please let me know the posibility. 




Oct 24, 2011 at 3:55 PM
Edited Oct 24, 2011 at 3:55 PM

Hello Ajesh,

The first release of the library was mainly for straight conversion of the SVG files and this
feature is not supported.

Currently, you can get part of that features if you take control of the conversion process
yourself. Basically, the code for the conversion is like this

private static DrawingGroup Convert(string fileName,
    WpfDrawingSettings settings)
    WpfDrawingRenderer wpfRenderer = new WpfDrawingRenderer(settings);
    WpfSvgWindow wpfWindow = new WpfSvgWindow(640, 480, wpfRenderer);

    wpfRenderer.LinkVisitor = new LinkVisitor();
    wpfRenderer.ImageVisitor = new EmbeddedImageVisitor();
    wpfRenderer.FontFamilyVisitor = new FontFamilyVisitor();


    wpfRenderer.InvalidRect = SvgRectF.Empty;

    wpfRenderer.Render(wpfWindow.Document as SvgDocument);

    return wpfRenderer.Drawing as DrawingGroup;

After loading the WpfSvgWindow.Document provides access to the SVG DOM. You can modify the
DOM in anyway, the SvgDocument is a derived from the .NET XmlDocument.

The changes will not automatically result in update of the output, you will still have to call the Render method
to recreate the output - which is not what you want but is a closer solution. 

Best regards,

Oct 25, 2011 at 5:08 AM

Hi Paul, 

Thanks for the reply. 

I was wondering if you have plans to release the next version. If so when its planned and what features it will have. 

Also do know about any other .Net library which can be used for viewing and editing the SVG. 

Thanks a lot,


Oct 25, 2011 at 5:33 AM

Hello Ajesh,

>>AjeshIf so when its planned and what features it will have 

Yes, there are plans to release a new version but it is not yet finalized and the feature set not completely
decided, but a completed viewer with the ability to manipulate the DOM is already decided.

Currently, I am working to complete another open source project by the end of the year and could only
take on the SharpVectors again early next year.

>>Ajesh:  Also do know about any other .Net library which can be used for viewing and editing the SVG.

For open source, there is no reliable library I know of for viewing and editing the SVG, the only commercial
library for converting SVG to XAML (but no editing) is also not as complete as the SharpVectors - that was
why I created the SharpVectors-Reloaded for use in a project at work and decided to make the
results available to others. The current limitation of the SharpVectors is due to the requirements of that project,
we needed only the conversion.

NOTE that things might have changed in the available commercial SVG to XAML product, making it more
useful, so please Google for it and try it - it is not good to provide you a link here since I said something bad
about it  :)

Best regards,