Share via


XamlResourceReferenceFailedEventArgs.Message プロパティ

定義

XAML リソース参照エラーの人間が判読できる説明 (英語) を取得します。

public:
 property Platform::String ^ Message { Platform::String ^ get(); };
winrt::hstring Message();
public string Message { get; }
var string = xamlResourceReferenceFailedEventArgs.message;
Public ReadOnly Property Message As String

プロパティ値

String

Platform::String

winrt::hstring

XAML リソース参照エラーの人間が判読できる説明 (英語)。

正しくないリソース参照 (OutputTextBlockStyl ではなく OutputTextBlockStyle) が意図的に挿入された後の WinUI ギャラリー サンプル アプリからのメッセージの例を次に示します。 目的のリソースが で App.xaml定義されていることがわかっている場合は、そこにリソースを見つけることができなかった場合、誤った参照の強力なインジケーターが表示されます。

注意

この出力例は説明のみを目的としています。 メッセージの正確な形式は実装定義であり、将来変更される可能性があります。 アプリケーションはメッセージの解析を試みてはなりません。

Beginning search for resource with key 'OutputTextBlockStyl'.
  Searching dictionary 'ms-appx:///Controls/ControlExample.xaml' for resource with key 'OutputTextBlockStyl'.
  Finished searching dictionary 'ms-appx:///Controls/ControlExample.xaml'.
  Searching dictionary 'Framework-defined colors' for resource with key 'OutputTextBlockStyl'.
  Finished searching dictionary 'Framework-defined colors'.
  Searching dictionary 'Framework ThemeResources.xbf' for resource with key 'OutputTextBlockStyl'.
    Searching theme dictionary (active theme: 'Light') for resource with key 'OutputTextBlockStyl'.
      Searching dictionary '<anonymous dictionary>' for resource with key 'OutputTextBlockStyl'.
      Finished searching dictionary '<anonymous dictionary>'.
    Finished searching theme dictionary (active theme: 'Light').
  Finished searching dictionary 'Framework ThemeResources.xbf'.
  Searching dictionary 'ms-appx:///App.xaml' for resource with key 'OutputTextBlockStyl'.
    Searching merged dictionary with index '1' for resource with key 'OutputTextBlockStyl'.
      Searching dictionary 'ms-appx:///Microsoft.UI.Xaml/Themes/themeresources.xaml' for resource with key 'OutputTextBlockStyl'.
        Searching theme dictionary (active theme: 'Light') for resource with key 'OutputTextBlockStyl'.
          Searching dictionary 'ms-appx:///Microsoft.UI.Xaml/Themes/themeresources.xaml' for resource with key 'OutputTextBlockStyl'.
          Finished searching dictionary 'ms-appx:///Microsoft.UI.Xaml/Themes/themeresources.xaml'.
        Finished searching theme dictionary (active theme: 'Light').
      Finished searching dictionary 'ms-appx:///Microsoft.UI.Xaml/Themes/themeresources.xaml'.
    Finished searching merged dictionary with index '1'.
    Searching merged dictionary with index '0' for resource with key 'OutputTextBlockStyl'.
      Searching dictionary 'ms-appx:///ItemTemplates.xaml' for resource with key 'OutputTextBlockStyl'.
      Finished searching dictionary 'ms-appx:///ItemTemplates.xaml'.
    Finished searching merged dictionary with index '0'.
    Searching theme dictionary (active theme: 'Light') for resource with key 'OutputTextBlockStyl'.
      Searching dictionary 'ms-appx:///App.xaml' for resource with key 'OutputTextBlockStyl'.
      Finished searching dictionary 'ms-appx:///App.xaml'.
    Finished searching theme dictionary (active theme: 'Light').
  Finished searching dictionary 'ms-appx:///App.xaml'.
Finished search for resource with key 'OutputTextBlockStyl'.

注釈

イベント データ内のメッセージには、失敗した XAML リソース参照に関する次の情報が含まれています。

  • 検索された各 ResourceDictionary を含む XAML ページの URI。
  • s が ResourceDictionary検索された順序。

この情報を使用して、XAML リソース参照を解決できなかった理由を調査できます。 たとえば、リソースを ResourceDictionary 含む が検索された の ResourceDictionary一覧に含まれていない場合や ResourceDictionary 、検索された場合は、正しくないリソース キーが指定されたことを示している可能性があります。

適用対象

こちらもご覧ください