BaseUri Property

FontFamily.BaseUri Property

Gets the base uniform resource identifier (URI) that is used to resolve a font family name.

Namespace: System.Windows.Media
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace:

public Uri BaseUri { get; }
/** @property */
public Uri get_BaseUri ()

public function get BaseUri () : Uri

You cannot use this property in XAML.

Property Value

A value of type Uri.

The return value is a null reference (Nothing in Visual Basic) if the font family name does not rely on a base URI for resolving the font reference. To retrieve the font family name that is used to construct the FontFamily object, use the Source property.

The following example shows the results of retrieving the BaseUri property from a FontFamily object.

// Create a new FontFamily object, using a font in the system fonts collection.
myTextBlock.FontFamily = new FontFamily("Comic Sans MS");

// The value of baseUri is null.
Uri baseUri = myTextBlock.FontFamily.BaseUri;

// Create a new FontFamily object, using an absolute URI reference.
myTextBlock.FontFamily = new FontFamily("file:///d:/MyFonts/#Pericles Light");

// The value of baseUri is null.
baseUri = myTextBlock.FontFamily.BaseUri;

// Create a new FontFamily object, using a base URI reference and a relative URI reference.
myTextBlock.FontFamily = new FontFamily(new Uri("pack://application:,,,/resources/"), "./#Pericles Light");

// The value of baseUri.AbsoluteUri is "pack://application:,,,/resources/".
baseUri = myTextBlock.FontFamily.BaseUri;

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

© 2016 Microsoft