Table of Contents

Class SVGImage

Namespace
SVGImage.SVG
Assembly
DotNetProjects.SVGImage.dll

This is the SVG image view control. The image control can either load the image from a file SetImage(string) or by setting the Drawing object through SetImage(Drawing), which allows multiple controls to share the same drawing instance.

public class SVGImage : Control, IAnimatable, ISupportInitialize, IFrameworkInputElement, IInputElement, IQueryAmbient, IUriContext
Inheritance
SVGImage
Implements
Inherited Members

Constructors

SVGImage()

public SVGImage()

Fields

CustomBrushesProperty

public static readonly DependencyProperty CustomBrushesProperty

Field Value

DependencyProperty

ExternalFileLoaderProperty

public static readonly DependencyProperty ExternalFileLoaderProperty

Field Value

DependencyProperty

FileSourceProperty

public static readonly DependencyProperty FileSourceProperty

Field Value

DependencyProperty

ImageSourcePoperty

public static readonly DependencyProperty ImageSourcePoperty

Field Value

DependencyProperty

IsGrayscaleProperty

public static readonly DependencyProperty IsGrayscaleProperty

Field Value

DependencyProperty

OverrideColorProperty

public static readonly DependencyProperty OverrideColorProperty

Field Value

DependencyProperty

OverrideFillColorProperty

public static readonly DependencyProperty OverrideFillColorProperty

Field Value

DependencyProperty

OverrideStrokeColorProperty

public static readonly DependencyProperty OverrideStrokeColorProperty

Field Value

DependencyProperty

OverrideStrokeWidthProperty

public static readonly DependencyProperty OverrideStrokeWidthProperty

Field Value

DependencyProperty

SizeTypeProperty

public static readonly DependencyProperty SizeTypeProperty

Field Value

DependencyProperty

SourceProperty

public static readonly DependencyProperty SourceProperty

Field Value

DependencyProperty

UriSourceProperty

Identifies the UriSource dependency property.

public static readonly DependencyProperty UriSourceProperty

Field Value

DependencyProperty

UseAnimationsProperty

public static readonly DependencyProperty UseAnimationsProperty

Field Value

DependencyProperty

Properties

BaseUri

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

public Uri BaseUri { get; set; }

Property Value

Uri

The base URI of the application context.

CustomBrushes

public Dictionary<string, Brush> CustomBrushes { get; set; }

Property Value

Dictionary<string, Brush>

ExternalFileLoader

public IExternalFileLoader ExternalFileLoader { get; set; }

Property Value

IExternalFileLoader

FileSource

public string FileSource { get; set; }

Property Value

string

ImageSource

public Drawing ImageSource { get; set; }

Property Value

Drawing

IsGrayscale

Displays the drawing in grayscale while preserving its alpha and vector geometry.

public bool IsGrayscale { get; set; }

Property Value

bool

OverrideColor

public Color? OverrideColor { get; set; }

Property Value

Color?

OverrideFillColor

public Color? OverrideFillColor { get; set; }

Property Value

Color?

OverrideStrokeColor

public Color? OverrideStrokeColor { get; set; }

Property Value

Color?

OverrideStrokeWidth

public double? OverrideStrokeWidth { get; set; }

Property Value

double?

SVG

public SVG SVG { get; }

Property Value

SVG

SizeType

public SVGImage.eSizeType SizeType { get; set; }

Property Value

SVGImage.eSizeType

Source

public string Source { get; set; }

Property Value

string

UriSource

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

public Uri UriSource { get; set; }

Property Value

Uri

A Uri specifying the path to the SVG source file. The file can be located on a computer, network or assembly resources. Settings this to null will close any opened diagram.

Remarks

This is the same as the Source property, and added for consistency.

See Also

UseAnimations

public bool UseAnimations { get; set; }

Property Value

bool

Methods

ArrangeOverride(Size)

Called to arrange and size the content of a Control object.

protected override Size ArrangeOverride(Size arrangeBounds)

Parameters

arrangeBounds Size

The computed size that is used to arrange the content.

Returns

Size

The size of the control.

MeasureOverride(Size)

Called to remeasure a control.

protected override Size MeasureOverride(Size constraint)

Parameters

constraint Size

The maximum size that the method can return.

Returns

Size

The size of the control, up to the maximum specified by constraint.

OnInitialized(EventArgs)

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

protected override void OnInitialized(EventArgs e)

Parameters

e EventArgs

The RoutedEventArgs that contains the event data.

OnRender(DrawingContext)

When overridden in a derived class, participates in rendering operations that are directed by the layout system. The rendering instructions for this element are not used directly when this method is invoked, and are instead preserved for later asynchronous use by layout and drawing.

protected override void OnRender(DrawingContext dc)

Parameters

dc DrawingContext

OnRenderSizeChanged(SizeChangedInfo)

Raises the SizeChanged event, using the specified information as part of the eventual event data.

protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)

Parameters

sizeInfo SizeChangedInfo

Details of the old and new size involved in the change.

ReRenderSvg()

Rerenders if CustomBrushesPropertyChanged, OverrideStrokeWidthPropertyChanged, OverrideStrokeColorPropertyChanged, OverrideFillColorPropertyChanged, OverrideColorPropertyChanged

public void ReRenderSvg()

SeekAnimations(TimeSpan)

Stops playback and displays the SVG at an exact animation time.

public void SeekAnimations(TimeSpan position)

Parameters

position TimeSpan

SetImage(Stream)

public void SetImage(Stream stream)

Parameters

stream Stream

SetImage(string)

public void SetImage(string svgFilename)

Parameters

svgFilename string

SetImage(Uri)

public void SetImage(Uri uriSource)

Parameters

uriSource Uri

SetImage(Drawing)

public void SetImage(Drawing drawing)

Parameters

drawing Drawing

TriggerAnimationEvent(string, string)

Forwards a named event to SMIL begin timing, such as button.click.

public void TriggerAnimationEvent(string elementId, string eventName = "click")

Parameters

elementId string
eventName string