Binding child usercontrol to datacontext of parent

Nov 15, 2010 at 7:21 PM

I'm trying to create a reusable child control that inherits its data context from its parent yet still uses CM conventions to wire up the bindings. It's not clear to me how to do this (if it's even possible). Any pointers? 

The scenario is a "status" panel that includes things like a Loading message, error message, or a status message. The View is reusable in that case, but the data source should be the ViewModel of the parent control. 

Coordinator
Nov 15, 2010 at 8:40 PM

Have you tried this?

<Parent ...>
 ...
   <StatusPanel cal:Bind.Model="{Binding}" />
 ...
</Parent>

Nov 16, 2010 at 12:42 AM

That worked! Thanks Rob!