Binding to a method from a DataTemplate

I have the following setup.

Case (object of type Case)
---> CaseNumber
---> GetRecipients() (returns a List<Recipient>

---> RecipientNumber
---> GetACWM()   (returns one object of type ACWM)

I have an ItemsControl that I am binding to Case (working fine), the DataTemplate for Case has an ItemsControl that I am binding to the GetRecipients() method (also working fine).  This bind is working because I set the ObjectInstance of my ObjectDataProvider (for Case) in the code behind when the case is provided.  I cannot do the same things for recipient because there are multiple recipients in a case.  So, in the recipient DataTemplate I  have an ObjectDataProvider (for Recipient).  How can I set the ObjectInstance of this ODP to the current recipient being bound?

I hope this was clear enough.
LVL 11
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


I'm not sure you can set the ODP instance from within your provider. However, could you not combine your providers into a  single provider and expose two properties, the recipients in one property and a property that indexes the recipients collection itself as your selected recipient?


jmwheelerAuthor Commented:
I was able to find a different way around.  I just made the recipient a separate control with a dependency property that gets set with the current instance of Recipient.  When the property is set I set other ODP's on the new Recipient Control with the recipient instance provided.

Thank you though.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.