New to Telerik UI for WinForms? Start a free 30-day trial

Provides utility methods for modifying the paint (fill/stroke) color of a RadSvgImage.

This helper is the single, centralized place for mutating the color of SVG images across the controls. It sets the Fill or Stroke of the selected SvgElement instances to the specified color and clears the image cache so the change is rendered. When no selector is provided, the first SvgPath in the document is used.

Definition

Namespace:Telerik.WinControls

Assembly:Telerik.WinControls.dll

Syntax:

C#
public static class TelerikSvgHelper

Inheritance: objectTelerikSvgHelper

Methods

Sets the fill color of the first SvgPath found in the specified image.

C#
public static bool SetFillColor(RadSvgImage svgImage, Color color)
Parameters:svgImageRadSvgImage

The image to modify.

colorColor

The fill color to apply.

Returns:

bool

true if the image was modified; otherwise, false.

Sets the fill color of the SvgElement instances returned by the specified selector.

C#
[CLSCompliant(false)]
public static bool SetFillColor(RadSvgImage svgImage, Func<RadSvgImage, IEnumerable<SvgElement>> selector, Color color)
Parameters:svgImageRadSvgImage

The image to modify.

selectorFunc<RadSvgImage, IEnumerable<SvgElement>>

A function returning the elements whose fill color should be updated. When null, the first SvgPath in the document is used.

colorColor

The fill color to apply.

Returns:

bool

true if the image was modified; otherwise, false.

Sets the stroke color of the first SvgPath found in the specified image.

C#
public static bool SetStrokeColor(RadSvgImage svgImage, Color color)
Parameters:svgImageRadSvgImage

The image to modify.

colorColor

The stroke color to apply.

Returns:

bool

true if the image was modified; otherwise, false.

Sets the stroke color of the SvgElement instances returned by the specified selector.

C#
[CLSCompliant(false)]
public static bool SetStrokeColor(RadSvgImage svgImage, Func<RadSvgImage, IEnumerable<SvgElement>> selector, Color color)
Parameters:svgImageRadSvgImage

The image to modify.

selectorFunc<RadSvgImage, IEnumerable<SvgElement>>

A function returning the elements whose stroke color should be updated. When null, the first SvgPath in the document is used.

colorColor

The stroke color to apply.

Returns:

bool

true if the image was modified; otherwise, false.