ResourceDictionaryWriter Class |
Namespace: Ab2d.Utility.ReaderSvg
public class ResourceDictionaryWriter
The ResourceDictionaryWriter type exposes the following members.
Name | Description | |
---|---|---|
ResourceDictionaryWriter |
Constructor.
|
Name | Description | |
---|---|---|
GeometrySettings |
GeometrySettings that are used to read svg file as geometries.
| |
UsedSvgReader |
Ab2d.ReaderSvg instance that is used to read svg files.
| |
XamlWriterSettings |
BaseXamlWriterSettings that is used for GetXaml method.
|
Name | Description | |
---|---|---|
AddFile |
Adds a svg or svgz file to the ResourceDictionary as WPF Shapes.
| |
AddGeometryFile |
Adds a svg or svgz file to the ResourceDictionary as Geometry.
| |
AddGeometryStream |
Adds a svg or svgz from stream to the ResourceDictionary as Geometry.
| |
AddStream |
Adds a svg or svgz from stream to the ResourceDictionary as WPF Shapes.
| |
CreateReaderSvg |
Creates a new instance of Ab2d.ReaderSvg class. Can be overridden to specify some special properties to created ReaderSvg.
| |
CreateXamlWriterSettings |
Creates a BaseXamlWriterSettings. It can be overriden to provide different Xaml settings or use SilverlightXamlWriterSettings.
| |
GetRootResourceKey |
GetRootResourceKey gets the name of the resource object that added by any Read method on ResourceDictionaryWriter.
| |
GetXaml |
Gets the xaml string of the ResourceDictionary with all added svg objects as resources.
| |
ReadSvgFile |
Reads svg file as shapes.
| |
ReadSvgStream |
Reads svg stream as shapes.
| |
Reset |
Resets the collected svg files so a new ResourceDictionary can be created.
| |
ResolveResourceKeyCallback |
ResolveResourceKeyCallback is used to change the recommendedKey that is used for resources
|
ResourceDictionaryWriter class is a helper class that can be used to build ResourceDictionaries from multiple input files.
Read more about how to use Resource Dictionaries on: http://msdn.microsoft.com/en-us/library/cc903952(VS.95).aspx
To customize the behaviour of ResourceDictionaryWriter it is possible to derive a custom class form ResourceDictionaryWriter and change protected fields or override its virtual methods.
The following code shows how to add three svg files to ResourceDictionary with basic optimization settings and get the xaml for the ResourceDictionary.
GeometrySettings settings = GeometrySettings.BasicOptimization; ResourceDictionaryWriter resourceWriter = new ResourceDictionaryWriter(); resourceWriter.AddGeometryFile("button1.svg", settings); resourceWriter.AddGeometryFile("button2.svg", settings); resourceWriter.AddGeometryFile("button3.svg", settings); string xaml = resourceWriter.GetXaml();
The following code shows how to derive a class from ResourceDictionaryWriter to create a Silverlight ResourceDictionaryWriter with custom NumberFormatString.
public class SilverlightResourceDictionaryWriter : Ab2d.Utility.ReaderSvg.ResourceDictionaryWriter { protected override BaseXamlWriterSettings CreateXamlWriterSettings() { SilverlightXamlWriterSettings newSilverlightXamlWriterSettings; newSilverlightXamlWriterSettings = new SilverlightXamlWriterSettings(); // format decimal numbers to show only one decimal newSilverlightXamlWriterSettings.NumberFormatString = "0.#"; return newSilverlightXamlWriterSettings; } }