FontFamily.BaseUri 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定用於解析字型系列名稱的統一資源識別項 (URI)。
public:
property Uri ^ BaseUri { Uri ^ get(); };
public Uri BaseUri { get; }
member this.BaseUri : Uri
Public ReadOnly Property BaseUri As 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 屬性。