Class
RadSvgImage

Represents a control for displaying SVG images in a WPF application. The RadSvgImage class allows for the rendering of SVG files or XML strings as visual content, providing various properties for customization such as UriSource, XmlSource, ImageSource, and options to override colors and stroke widths. It supports animations and custom brushes, enabling the user to tailor the SVG image's appearance to fit specific requirements. The class integrates with the WPF rendering system, ensuring appropriate measurement and layout through dependency properties such as SizeType. Additionally, it handles loading SVG data from various sources, including local files and URI schemes, while maintaining the application’s context through the BaseUri property.

Definition

Namespace:Telerik.Windows.Controls

Assembly:Telerik.Windows.Controls.dll

Syntax:

cs-api-definition
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Svg")]
[TelerikToolboxCategory("Common")]
public class RadSvgImage : Control, IUriContext

Inheritance: objectRadSvgImage

Implements: IUriContext

Constructors

RadSvgImage()

Initializes a new instance of the RadSvgImage class.

Declaration

cs-api-definition
public RadSvgImage()

Fields

CustomBrushesProperty

Identifies the CustomBrushes dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty CustomBrushesProperty

Field Value

DependencyProperty

ImageSourceProperty

Identifies the ImageSource dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty ImageSourceProperty

Field Value

DependencyProperty

OverrideColorProperty

Identifies the OverrideColor dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty OverrideColorProperty

Field Value

DependencyProperty

OverrideStrokeWidthProperty

Identifies the OverrideStrokeWidth dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty OverrideStrokeWidthProperty

Field Value

DependencyProperty

SizeTypeProperty

Identifies the SizeType dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty SizeTypeProperty

Field Value

DependencyProperty

UriSourceProperty

Identifies the UriSource dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty UriSourceProperty

Field Value

DependencyProperty

UseAnimationsProperty

Identifies the UseAnimations dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty UseAnimationsProperty

Field Value

DependencyProperty

XmlSourceProperty

Identifies the XmlSource dependency property.

Declaration

cs-api-definition
public static readonly DependencyProperty XmlSourceProperty

Field Value

DependencyProperty

Properties

BaseUri

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

Declaration

cs-api-definition
public Uri BaseUri { get; set; }

Property Value

Uri

The base URI of the application context.

CustomBrushes

Gets or sets the collection of custom brushes.

Declaration

cs-api-definition
[SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public Dictionary<string, Brush> CustomBrushes { get; set; }

Property Value

Dictionary<string, Brush>

ImageSource

Gets or sets a Drawing that can be used for building the SVG image.

Declaration

cs-api-definition
public Drawing ImageSource { get; set; }

Property Value

Drawing

OverrideColor

Gets or sets a value which is used to replace the fill color of this SVG image.

Declaration

cs-api-definition
public Color? OverrideColor { get; set; }

Property Value

Color?

OverrideStrokeWidth

Gets or sets a value which is used to replace the stroke width of this SVG image.

Declaration

cs-api-definition
public double? OverrideStrokeWidth { get; set; }

Property Value

double?

SizeType

Gets or sets the size type of the image.

Declaration

cs-api-definition
public SizeType SizeType { get; set; }

Property Value

SizeType

UriSource

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

Declaration

cs-api-definition
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.

UseAnimations

Gets or sets a value indicating whether the animations are used on this SVG image instance.

Declaration

cs-api-definition
public bool UseAnimations { get; set; }

Property Value

bool

XmlSource

Gets or sets a value which is a XML-based string used as a source for this SVG image instance. This property is set only by the user and is not set internally by the control.

Declaration

cs-api-definition
public string XmlSource { get; set; }

Property Value

string

Methods

ArrangeOverride(Size)

Declaration

cs-api-definition
protected override Size ArrangeOverride(Size arrangeBounds)

Parameters

arrangeBounds

Size

Returns

Size

MeasureOverride(Size)

Declaration

cs-api-definition
protected override Size MeasureOverride(Size constraint)

Parameters

constraint

Size

Returns

Size

OnCreateAutomationPeer()

Creates a RadSvgImageAutomationPeer.

Declaration

cs-api-definition
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "Reviewed.")]
protected override AutomationPeer OnCreateAutomationPeer()

Returns

AutomationPeer

OnInitialized(EventArgs)

Declaration

cs-api-definition
protected override void OnInitialized(EventArgs e)

Parameters

e

EventArgs

OnRender(DrawingContext)

Declaration

cs-api-definition
protected override void OnRender(DrawingContext drawingContext)

Parameters

drawingContext

DrawingContext

OnRenderSizeChanged(SizeChangedInfo)

Declaration

cs-api-definition
protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)

Parameters

sizeInfo

SizeChangedInfo