4

TKeyがXAMLの文字列であることを辞書にバインドしたいとします。

<Label DataContext="{MyDictionary}" Content="{Binding Item("OK")}" />

動作しません。

どうすればいいですか?

私はItem( "Key")について話している

4

1 に答える 1

12

それを試してください:

<Label DataContext="{Binding MyDictionary}" Content="{Binding [OK]}" />

またはそれ(少し簡単):

<Label Content="{Binding MyDictionary[OK]}" />
于 2009-09-14T09:40:09.293 に答える