Stringキーを使用したインデックス付きプロパティへのバインド
-
07-07-2019 - |
質問
TKeyがXAMLの文字列であることを辞書にバインドするとします:
<Label DataContext="{MyDictionary}" Content="{Binding Item("OK")}" />
動作しません。
どうすればいいですか?
Item(&quot; Key&quot;)について話している
解決
試してみてください:
<Label DataContext="{Binding MyDictionary}" Content="{Binding [OK]}" />
またはそれ(少し単純):
<Label Content="{Binding MyDictionary[OK]}" />
所属していません StackOverflow