Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF Binding to items within a dictionary by key?

I can bind to a collection item using index:

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

but what about using a dictionary key?

Path=Exchanges['AMEX'].Name 
like image 571
Sonic Soul Avatar asked Jun 05 '10 15:06

Sonic Soul


People also ask

What is two way binding WPF?

Its very easy to do in WPF in comparison of windows Application programming. Two way binding is used when we want to update some controls property when some other related controls property change and when source property change the actual control also updates its property.

What is path binding WPF?

Binding path syntax. Use the Path property to specify the source value you want to bind to: In the simplest case, the Path property value is the name of the property of the source object to use for the binding, such as Path=PropertyName . Subproperties of a property can be specified by a similar syntax as in C#.


1 Answers

yep.. works like a charm

<TextBlock FontStyle="Italic"  Text="{Binding Path=ExchangesDictionary[AMEX].Name}" /> 
like image 162
Sonic Soul Avatar answered Sep 28 '22 02:09

Sonic Soul