FontFamily.BaseUri 属性

定义

获取用于解析字体系列名称的基本统一资源标识符 (URI)。

public:
 property Uri ^ BaseUri { Uri ^ get(); };
public Uri BaseUri { get; }
member this.BaseUri : Uri
Public ReadOnly Property BaseUri As Uri

属性值

Uri

一个 Uri 类型的值。

示例

以下示例显示从FontFamily对象检索BaseUri属性的结果。

// 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;
' 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.
Dim baseUri As Uri = 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

注解

返回值是 null ,如果字体系列名称不依赖于用于解析字体引用的基 URI。 若要检索用于构造 FontFamily 对象的字体系列名称,请使用该 Source 属性。

适用于