In This Article

UriConverter Class

Represents a value converter that returns a new System.Uri instance created using the specified URI string combined with an optional URI prefix.

[ValueConversion(typeof(string), typeof(Uri))]
public class UriConverter : DependencyObject
Inheritance:
object object

Remarks

This converter expects the source value to be a string which, when combined with the UriPrefix, can be used to create a new System.Uri instance.

Constructors

UriConverter()

Initializes an instance of the class.

public UriConverter()

Properties

UriPrefix

The URI prefix that should be prepended to all values converted by this object.

public string UriPrefix { get; set; }

Property Value

string

Methods

Convert(object?, Type, object?, CultureInfo)

Converts the specified URI, in the form of a string to a System.Uri.

public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
Parameter Type Description
value object

The value produced by the binding source.

targetType Type

The type of the binding target property.

parameter object

The converter parameter to use.

culture CultureInfo

The culture to use in the converter.

Returns

object:

A System.Uri associated with the specified URI string.

ConvertBack(object?, Type, object?, CultureInfo)

This method always returns null and should not be used.

public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
Parameter Type Description
value object

Not used.

targetType Type

Not used.

parameter object

Not used.

culture CultureInfo

Not used.

Returns

object:

null.

Fields

UriPrefixProperty

Defines the UriPrefix property.

public static readonly DependencyProperty UriPrefixProperty

Extension Methods