Export (0) Print
Expand All

IUriContext Interface

Represents a service that can use application context to resolve a provided relative URI to an absolute URI.

Namespace:  System.Windows.Markup
Assembly:  System.Xaml (in System.Xaml.dll)

public interface IUriContext

The IUriContext type exposes the following members.

  NameDescription
Public propertyBaseUriGets or sets the base URI of the current application context.
Top

IUriContext implemented as a service enables type converters to use an application-specific context that might be able to complete a URI-type property.

Type converters and markup extensions can query for IUriContext as a service on the service context that is provided by a XAML object writer, when the XAML object writer invokes value conversion behavior. For more information, see Type Converters and Markup Extensions for XAML and Service Contexts Available to Type Converters and Markup Extensions.

IUriContext is not just for value conversion and service context. Class logic for UI elements or other classes that support containment might also implement IUriContext services as a recognized pattern that child elements can call for base URI information, or store base URI information that is obtained from XAML parsing of the root element.

In previous versions of the .NET Framework, this interface existed in the WPF-specific assembly PresentationCore. In .NET Framework 4, IUriContext is in the System.Xaml assembly. For more information, see Types Migrated from WPF to System.Xaml.

WPF Usage Notes

Example scenarios for IUriContext exist in WPF.

As an example of a value converter, the FontFamilyConverter class can use a relative URI that is provided for properties such as Page.FontFamily, if IUriContext is available as a service on the ITypeDescriptorContext input.

As an example of the element case, Hyperlink implements IUriContext so that it can pass through base URI values when parsed, which then modifies NavigateUri.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft