CustomXamlResourceLoader.GetResource(String, String, String, String) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
當在衍生類別中覆寫時,會指定此 CustomXamlResourceLoader 的資源查找邏輯。 給定一個資源 ID 及關於預期結果的某種類型資訊,會回傳所請求的資源。
protected:
virtual Platform::Object ^ GetResource(Platform::String ^ resourceId, Platform::String ^ objectType, Platform::String ^ propertyName, Platform::String ^ propertyType) = GetResource;
IInspectable GetResource(winrt::hstring const& resourceId, winrt::hstring const& objectType, winrt::hstring const& propertyName, winrt::hstring const& propertyType);
protected virtual object GetResource(string resourceId, string objectType, string propertyName, string propertyType);
function getResource(resourceId, objectType, propertyName, propertyType)
Protected Overridable Function GetResource (resourceId As String, objectType As String, propertyName As String, propertyType As String) As Object
參數
- resourceId
-
String
Platform::String
winrt::hstring
取得資源的字串形式金鑰。
- objectType
-
String
Platform::String
winrt::hstring
資源的預期類型。
- propertyName
-
String
Platform::String
winrt::hstring
在自訂資源查找邏輯中作為鍵的屬性名稱。
- propertyType
-
String
Platform::String
winrt::hstring
作為鍵的屬性類型,類型以字串表示。
傳回
被檢索的資源。
備註
當 Windows 執行階段 XAML 解析器遇到 {CustomResource} 標記擴充功能使用時,會呼叫此方法。 resourceId 來自 {CustomResource} 標記擴充的預設鍵標記擴展參數,其他輸入參數則來自上下文,例如應用於哪個屬性。