I have a test dictionary
MyDict = new Dictionary<string, Uri>
{
{"First", new Uri("alma.jpg", UriKind.Relative)},
{"Second", new Uri("korte.jpg", UriKind.Relative)}
};
and a simple XAML
<TextBlock Text="{Binding MyDict[First]}"
FontSize="13" Width="200" Height="30" />
That shows perfectly the First key element Value
What I want is
I have a string variable: DictKey
Lets DictKey="First"
How to rewrite the XAML to use this variable
<TextBlock Text="{Binding MyDict[???DictKey????]}"
FontSize="13" Width="200" Height="30" />
thx.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…