Marti
Marti

Reputation: 35

Binding two collections with a common parameter

I would like to display the content of two differents ObservableCollection in a same grid. They have a parameter in common (an id) and I want to link the two collections thanks to this id. I suppose I must use a multi binding, but how can I say I want to "link" the ids?

If I'm not clear enough, just say me.

Thanks,

M.

Upvotes: 1

Views: 96

Answers (1)

Arsen Mkrtchyan
Arsen Mkrtchyan

Reputation: 50712

No MultiBinding can't help in this case

If there is one to one relation you can add property of second class to first class which returns correct item and access to second object by that property in binding, like this

{Binding classA.propB.Name}

Another way to do this I see now, is to create wrapepr class, which wraps both in one, and create new observablecollection property which contains joined collections

Hope this helps

Upvotes: 1

Related Questions