Class SVGImage
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
ExternalFileLoaderProperty
public static readonly DependencyProperty ExternalFileLoaderProperty
Field Value
FileSourceProperty
public static readonly DependencyProperty FileSourceProperty
Field Value
ImageSourcePoperty
public static readonly DependencyProperty ImageSourcePoperty
Field Value
IsGrayscaleProperty
public static readonly DependencyProperty IsGrayscaleProperty
Field Value
OverrideColorProperty
public static readonly DependencyProperty OverrideColorProperty
Field Value
OverrideFillColorProperty
public static readonly DependencyProperty OverrideFillColorProperty
Field Value
OverrideStrokeColorProperty
public static readonly DependencyProperty OverrideStrokeColorProperty
Field Value
OverrideStrokeWidthProperty
public static readonly DependencyProperty OverrideStrokeWidthProperty
Field Value
SizeTypeProperty
public static readonly DependencyProperty SizeTypeProperty
Field Value
SourceProperty
public static readonly DependencyProperty SourceProperty
Field Value
UriSourceProperty
Identifies the UriSource dependency property.
public static readonly DependencyProperty UriSourceProperty
Field Value
UseAnimationsProperty
public static readonly DependencyProperty UseAnimationsProperty
Field Value
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
ExternalFileLoader
public IExternalFileLoader ExternalFileLoader { get; set; }
Property Value
FileSource
public string FileSource { get; set; }
Property Value
ImageSource
public Drawing ImageSource { get; set; }
Property Value
IsGrayscale
Displays the drawing in grayscale while preserving its alpha and vector geometry.
public bool IsGrayscale { get; set; }
Property Value
OverrideColor
public Color? OverrideColor { get; set; }
Property Value
OverrideFillColor
public Color? OverrideFillColor { get; set; }
Property Value
OverrideStrokeColor
public Color? OverrideStrokeColor { get; set; }
Property Value
OverrideStrokeWidth
public double? OverrideStrokeWidth { get; set; }
Property Value
SVG
public SVG SVG { get; }
Property Value
SizeType
public SVGImage.eSizeType SizeType { get; set; }
Property Value
Source
public string Source { get; set; }
Property Value
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
Methods
ArrangeOverride(Size)
Called to arrange and size the content of a Control object.
protected override Size ArrangeOverride(Size arrangeBounds)
Parameters
arrangeBoundsSizeThe 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
constraintSizeThe 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
eEventArgsThe 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
OnRenderSizeChanged(SizeChangedInfo)
Raises the SizeChanged event, using the specified information as part of the eventual event data.
protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
Parameters
sizeInfoSizeChangedInfoDetails 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
positionTimeSpan
SetImage(Stream)
public void SetImage(Stream stream)
Parameters
streamStream
SetImage(string)
public void SetImage(string svgFilename)
Parameters
svgFilenamestring
SetImage(Uri)
public void SetImage(Uri uriSource)
Parameters
uriSourceUri
SetImage(Drawing)
public void SetImage(Drawing drawing)
Parameters
drawingDrawing
TriggerAnimationEvent(string, string)
Forwards a named event to SMIL begin timing, such as button.click.
public void TriggerAnimationEvent(string elementId, string eventName = "click")