Table of Contents

Class SvgCanvas

Namespace
SharpVectors.Converters
Assembly
SharpVectors.Converters.Wpf.dll

This is a Canvas control for viewing SVG file in WPF applications.

public class SvgCanvas : SvgDrawingCanvas, IAnimatable, IFrameworkInputElement, IInputElement, ISupportInitialize, IQueryAmbient, IAddChild, ISvgControl, IUriContext
Inheritance
SvgCanvas
Implements
Inherited Members

Remarks

It extends the drawing canvas, SvgDrawingCanvas, instead of generic Canvas control, therefore any interactivity support implemented in the drawing canvas will be available in the Canvas.

Constructors

SvgCanvas()

Initializes a new instance of the SvgCanvas class.

Fields

AppNameProperty

The DependencyProperty for the AppName property.

MessageBackgroundProperty

The DependencyProperty for the MessageBackground property.

Flags: Can be used in style rules

Default Value: PapayaWhip

MessageFillBrushProperty

The DependencyProperty for the MessageFillBrush property.

Flags: Can be used in style rules

Default Value: Gold

MessageFontFamilyProperty

The DependencyProperty for the MessageFontFamily property.

Flags: Can be used in style rules

Default Value: System Dialog Font

MessageFontSizeProperty

The DependencyProperty for the MessageFontSize property.

Flags: Can be used in style rules

Default Value: 48 pixels

MessageOpacityProperty

The DependencyProperty for the MessageOpacity property.

Flags: Can be used in style rules

Default Value: 1 (full opacity)

MessageStrokeBrushProperty

The DependencyProperty for the MessageStrokeBrush property.

Flags: Can be used in style rules

Default Value: Maroon

MessageTextProperty

The DependencyProperty for the MessageText property.

Flags: Can be used in style rules

Default Value: "Loading..."

SourceProperty

Identifies the Source dependency property.

StreamSourceProperty

Identifies the StreamSource dependency property.

SvgSourceProperty

Identifies the SvgSource dependency property.

UriSourceProperty

Identifies the UriSource dependency property.

Properties

AppName

Gets or sets the name of the parent assembly for this element.

AutoSize

Gets or sets a value indicating whether to automatically resize this Canvas based on the size of the loaded drawing.

BaseUri

Gets or sets the base URI of the current application context.

CultureInfo

Gets or sets the main culture information used for rendering texts.

Drawings

Gets the drawing from the SVG file conversion.

EnsureViewboxPosition

Gets or sets a value to indicate applying a translate transform to the viewbox to ensure it is visible when rendered.

EnsureViewboxSize

Gets or sets a value to indicate preserving the original viewbox size when saving images.

IgnoreRootViewbox

Gets or sets a value to indicate turning off viewbox at the root of the drawing.

IncludeRuntime

Gets or sets a value indicating whether the SharpVectors.Runtime.dll classes are used in the generated output.

MessageBackground

Gets or sets a brush that describes the background of a message text.

MessageFillBrush

Gets or sets the brush with which to fill the message text. This is optional, and can be null. If the brush is null, no fill is drawn.

MessageFontFamily

Gets or sets the font family of the desired font for the message text.

MessageFontSize

Gets or sets the size of the desired font for the message text.

MessageOpacity

Gets or sets the opacity factor applied to the entire message text when it is rendered in the user interface (UI).

MessageStrokeBrush

Gets or sets the brush of the Pen with which to stroke the message text. This is optional, and can be null. If the brush is null, no stroke is drawn.

MessageText

Gets or sets the content of the message.

OptimizePath

Gets or sets a value indicating whether the path geometry is optimized using the StreamGeometry.

Source

Gets or sets the path to the SVG file to load into this Canvas.

StreamSource

Gets or sets the Stream to the SVG source to load into this Canvas.

SvgSource

Gets or sets the SVG contents to load into this Canvas.

TextAsGeometry

Gets or sets a value indicating whether the texts are rendered as path geometry.

UriSource

Gets or sets the path to the SVG file to load into this Canvas.

Methods

CreateDrawing()

Performs the conversion of a valid SVG source to the DrawingGroup.

CreateDrawing(Stream, WpfDrawingSettings)

Performs the conversion of a valid SVG source stream to the DrawingGroup.

CreateDrawing(string, WpfDrawingSettings)

Performs the conversion of a valid SVG source stream to the DrawingGroup.

CreateDrawing(Uri, WpfDrawingSettings)

Performs the conversion of a valid SVG source file to the DrawingGroup.

GetDrawingSettings()

Gets the rendering settings or options to be used in rendering the SVG in this control.

Load(Stream, bool, bool)

This sets the source SVG for a SvgCanvas by accessing a stream and optionally processing the result asynchronously.

Load(string, bool)

This sets the source SVG for a SvgCanvas by accessing text content and optionally processing the result asynchronously.

Load(Uri, bool)

This sets the source SVG for a SvgCanvas by using the supplied Uniform Resource Identifier (URI) and optionally processing the result asynchronously.

LoadAsync(Stream, bool)

This sets the source SVG for a SvgCanvas by accessing a stream and processing the result asynchronously.

LoadAsync(string)

This sets the source SVG for a SvgCanvas by accessing text contents and processing the result asynchronously.

LoadAsync(Uri)

This sets the source SVG for a SvgCanvas by using the supplied Uniform Resource Identifier (URI) and processing the result asynchronously.

OnAutoSizeChanged()

This handles changes in the automatic resizing property of this control.

OnInitialized(EventArgs)

Raises the Initialized event. This method is invoked whenever IsInitialized is set to true.

OnSettingsChanged()

This handles changes in the rendering settings of this control.

Unload(bool, string)

This clears the SvgCanvas of any drawn diagram and optionally displays a message.

See Also