GridRow Binding Advice

Topics: Actions & Coroutines, UI Architecture
Dec 13, 2011 at 6:16 PM

Hi all

I am using WPF and have a datagrid that represents a bunch of items. For each row in the grid I have a details section which displays another user control.

I am currently binding the user control to a nested viewmodel using the cal:Bind.Model syntax and all is working well.

I would like to pass the details user control the current item in the gridrow so that the details view model can do some stuff with it.

Any ideas on how I can do this?


Another description of the class layout is as follows:

MasterView -> MasterViewModel -> Collection of MasterModels

DetailView -> DetailViewModel -> Working on a MasterModel as provided by the selected master row in the MasterView.


Instead of the MasterViewModel exposing an observable collection of MasterModels I could have it expose a collection of DetailViewModels each containing the underlying instance of the relevant MasterModel. For some reason I like to keep these separate in case I want to use the DetailView and DetailViewModel separately from the MasterView use case.