Reputation: 8474
How to bind let's say TextBox.Text
to myDictionary["testElement"]
?
Upvotes: 4
Views: 151
Reputation: 184516
Have you tried removing the quotes around testElement
? If the key is a string that should work.
Indexers of a property can be specified within square brackets following the property name where the indexer is applied. For instance, the clause Path=ShoppingCart[0] sets the binding to the index that corresponds to how your property's internal indexing handles the literal string "0". Multiple indexers are also supported.
[...]
Inside indexers you can have multiple indexer parameters separated by commas (,). The type of each parameter can be specified with parentheses. For example, you can have Path="[(sys:Int32)42,(sys:Int32)24]", where sys is mapped to the System namespace.
Upvotes: 4
Reputation: 2990
The best way is to use a derived from IValueConvertor class. You bind to the dictionary itself, and set the ConverterParameter='testElement', in your converter you get both the dictionary and the key and return what's needed.
Upvotes: 2