Click or drag to resize
AB4D logo

ResourceDictionaryWriterCreateXamlWriterSettings Method

Creates a BaseXamlWriterSettings. It can be overriden to provide different Xaml settings or use SilverlightXamlWriterSettings.

Namespace:  Ab2d.Utility.ReaderSvg
Assembly:  Ab2d.ReaderSvg (in Ab2d.ReaderSvg.dll) Version: 7.1.7295.1040
Syntax
C#
protected virtual BaseXamlWriterSettings CreateXamlWriterSettings()

Return Value

Type: BaseXamlWriterSettings
BaseXamlWriterSettings
Remarks

The CreateXamlWriterSettings method by default creates an instance of WpfXamlWriterSettings that is used for GetXaml method.

The method can be overriden to create an instance of SilverlightXamlWriterSettings instead of WpfXamlWriterSettings. The derived method can also set some properties, for example NumberFormatString.

Note that in order to work correctly the following properties cannot be changed in derived class:
NamedObjects, RootObject, XamlNamespace, StartComment, WriteElementNames and WriteRootObjectResouceKey.

Other setting such as NumberFormatString and others can be changed to any other values.

Examples

The following sample creates a new SilverlightResourceDictionaryWriter that derive from ResourceDictionaryWriter. It creates an instance of SilverlightXamlWriterSettings instead of WpfXamlWriterSettings and also sets a 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;
    }
}
See Also