开发者

WPF Binding to items within a dictionary by key?

开发者 https://www.devze.com 2023-01-02 04:37 出处:网络
I can bind to a collection item using index: <TextBlock FontStyle=\"Italic\"Text=\"{Binding Path=Exchanges[0].Name}\" />

I can bind to a collection item using index:

<TextBlock FontStyle="Italic"  Text="{Binding Path=Exchanges[0].Name}" />

bu开发者_开发问答t what about using a dictionary key?

Path=Exchanges['AMEX'].Name


yep.. works like a charm

<TextBlock FontStyle="Italic"  Text="{Binding Path=ExchangesDictionary[AMEX].Name}" />
0

精彩评论

暂无评论...
验证码 换一张
取 消