共用方式為


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

備註

如果字型系列名稱不依賴基底 URI 來解析字型參考,則傳回值為 null 。 若要擷取用來建構 FontFamily 物件的字型系列名稱,請使用 Source 屬性。

適用於