Click or drag to resize
AB4D logo

ReaderSvgSetSvgNameToParentTransformCanvas Property

Gets or sets a boolean that specifies if object name is set to the Canvas that is created to contain object's transformation when the object also defines the Canvas.Left and Canvas.Top properties. Default value is false.

Namespace:  Ab2d
Assembly:  Ab2d.ReaderSvg (in Ab2d.ReaderSvg.dll) Version: 7.1.7295.1040
Syntax
C#
public bool SetSvgNameToParentTransformCanvas { get; set; }

Property Value

Type: Boolean
Remarks

When svg element uses both position (x and y attributes) and transformation, then ReaderSvg creates a parent Canvas that contains object's transformation. This way the object can preserve the same position values as in svg file (specified with Canvas.Left and Canvas.Top properties) and also the same transformation.

For example (first svg element and then WPF element):

<rect id="rect1" x="20" y="10" transform="matrix(-1 0 0 1 0 0)" />
<Canvas Name="rect1_transform" RenderTransform="-1 0 0 1 0 0" >
    <Rectangle Name="rect1" Canvas.Left="20" Canvas.Top="10" />
</Canvas>

The sample shows that in order to preserve all the attribute values a new parent canvas needs to be created.

The property SetSvgNameToParentTransformCanvas is used to specify which element (in our example Canvas or Rectangle) will get the name of the original svg element ("rect1" in our example).

When the SetSvgNameToParentTransformCanvas is set to false (by default) the Rectangle gets the name from svg element and the created Canvas gets the name created from svg name and the format string specified by the TransformCanvasNameFormatString property - by default "_transform" suffix.

When the SetSvgNameToParentTransformCanvas is set to true, the svg name is set to the Canvas element. The Rectangle does not get any name specified. This value can be used to preserve the backward compatibility with older version of ReaderSvg.

NOTE: If you want to optimize the hierarchy of the objects and do not want to have many Canvas objects, you can set the FlattenHierarchies property to true before reading the svg file and the read objects will have only minimal amount of Canvases.

See Also