Can I data bind to a indexed property where a property of the parent is the index

Using WPF with MVVM, my VM has an indexed property

IObject1 this[string key]

I need to bind a property of the view to a property of IObject1, and the key of the object1 that I need is the name of the control in the view. Essentially I need nested bindings

<TextBlock x:Name="Key1"  Text="{Binding ["Key1"].DisplayText}

but, the name will very for different items so I need the nested binding

<TextBlock x:Name="Key1"  Text="{Binding [{Binding Name, RelativeSource={RelativeSource Self}].DisplayText}

My actual case is more complicated than this, but if I can get this far I think that I can figure out the rest.

I'm using Blend, and I'd love a way to teach my designer to do this type of thing within Blend, but I'm happy to use code if I need to.

Am I overlooking something obvious? I can't figure out how to do this and I haven't stumbled upon the correct Google / Stack Overflow search term.

Thanks.

Answers


That's a weird solution lol, anyhose, you can solve it with MultiBinding & converters.

<TextBlock.Text>
<MultiBinding Converter={StaticResource combine}>
<Binding Path=Dictionary />
<Binding Path=Name />
</Multibinding>

Need Your Help

How to show a date in expression

javascript angularjs date

I am trying to to show a date in an expression but getting a error. Here is a snippet of my code:

Android: AppWidget with custom view not working

android android-widget

I am creating a appwidget that consists of a single custom view called Foo.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.