Pergunta

Say I wanna se ligam a dicionário que TKey é string com XAML:

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

não funciona.

Como devo fazê-lo?

Eu estou falando sobre o Item ( "Key")

Foi útil?

Solução

Tente isso:

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

Ou que (um pouco mais simples):

<Label Content="{Binding MyDictionary[OK]}" />
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top