ViewerSvg是一個WPF和Sileverlight的svg到xaml的轉換器。
ViewerSvg is a svg to xaml converter for WPF and Silverlight.

Svg是一種最常用的存儲2D矢量圖像的文件格式。幾乎所有的矢量繪圖程序都能夠保存它的繪圖為svg文件—例如:Adobe® Illustrator®, CorelDRAW®, Inkscape, Microsoft Visio等。
這就意味著設計者們能夠使用它們喜愛的設計工具來為WPF和Silverlight應用程序來創建矢量圖形。還有在Microsoft Visio或者其他應用程序中創建的靜態圖表能夠在WPF或Silverlight中被簡單地轉換為動態圖表。
使用ViewerSvg創建的svg文件能夠被轉換為XAML文件。因為對象的名字及其它們所有的屬性是被保存著的,應用程序開發人員對操縱的繪圖具有完全的控制能力。它可以使得WPF或Silverlight平臺添加鼠標事件,更改顏色,動畫的元素和做其它所有的更改。
在svg文件中的元素能夠被轉換成形狀或幾何對象(僅在WPF中)。這些形狀(畫布,橢圓,路徑等)是非常不錯的,因為它們可以簡單地被修改和為他們分配鼠標事件。幾何對象(GeometryDrawing, PathGeometry等)是形狀的一個輕量級的版本,它們具有更好的性能和更低的內存使用率,但操縱它們變得更困難。因此,圖形對象對復雜的繪圖是一個主意。并且更多的讀取幾何對象能夠為更好的性能被更高的優化。
ViewerSvg使用Ab2d.ReaderSvg庫在運行時從svg文件導入對象到svgz文件中。使用該庫使得它可以使用svg文件就像jpg,png或其他文件一樣。Ab2d.ReaderSvg還擁有許多先進的選項和其它的當在使用一個轉換的xaml文件時時不可能的可能選項。
特點:
為WPF和Silverlight轉換svg和svgz文件為xaml。
從id屬性或標題元素讀取元素名稱。
讀取高級的svg元素,如patterns, markers和gradients。
重命名導入的對象。
導出嵌入的圖像到圖像文件中。
轉換對象為形狀或幾何圖形對象。
附加的幾何圖形對象的優化。
文本轉換成PathGeometry。
多個文件批量轉換。
自動調整svg文件內容的大小。
調整讀取的畫布大小。
導出選定的元素為位圖圖像。
通過制定的小數的個數來控制XAML的大小。
導出自定義屬性刀xml序列化的DataTable。

Svg is one of the most commonly used file format for storing 2D vector images. Almost all vector drawing programs can save its drawings into svg file - for example: Adobe® Illustrator®, CorelDRAW®, Inkscape, Microsoft Visio, etc.
This means that designers can use their favourite design tool to create vector graphics for WPF or Silverlight applications. Also static diagrams that were created in Microsoft Visio or some other application can be simply turned into dynamic diagrams in WPF or Silverlight.
With ViewerSvg the created svg files can be converted into XAML. Because the names of the objects and all their properties are preserved, the application developers have full control to manipulate the drawing. It is possible to add mouse events, change colors, animate the elements and do all other changes that WPF or Silverlight platform enables.
The elements in svg file can be converted into shapes or geometry objects (WPF only). The shapes (Canvas, Ellipse, Path, etc.) are great because they can be simply modified and mouse events can be assigned to them. Geometry objects (GeometryDrawing, PathGeometry, etc.) are a lightweight version of shapes that have much better performance and lower memory usage but are harder to manipulate. Thereforeg graphics objects are ideal for complex drawings. And what is more the read geometry can be furher optimized for even better performance.
ViewerSvg is using the Ab2d.ReaderSvg library that imports objects from svg and svgz files at runtime. With the library it is possible to use svg files just as jpg, png or other files. Ab2d.ReaderSvg also has many advanced options and other possiblities that are not possible when using a converted xaml file.
Features:
- Convert svg and svgz files into xaml for WPF and Silverlight.
- Read element names from id attribute or title element.
- Read advanced svg elements such as patterns, markers and gradients.
- Rename imported objects.
- Export embedded images into image files.
- Convert objects into Shapes or Geometry objects.
- Additional optimization of Geometry objects.
- Convert texts into PathGeometry
- Batch convertion of multile files.
- Auto size of svg file content.
- Resize read canvas.
- Export selected elements as bitmap image.
- Control the size of XAML with specifing number of decimals.
- Export custom properties into xml serialized DataTable.