c# - wpf mvvm - master detail in one view best implementation? -


i have view contains datagrid. below datagrid have controls edit properties of selected item (lets manager) datagrid.

so have property bound datagrid selecteditem:

a manager has example property called name. when manager selected. textbox below datagrid has bound name property can in xaml this:

<textbox text="{binding path=selectedmanager.name, updatesourcetrigger=propertychanged}" /> 

the problem implement code when value of selectedmanager.name changes need property in viewmodel this:

private manager _selectedmanager; public manager selectedmanager {     { return _selectedmanager; }     set     {         _selectedmanager = value;         raisepropertychanged("selectedmanager");     } } 

so when selectedmanager changes not update managername property ofcourse. have 3 solutions , know think these or have better way. solutuions are:

1: when selectedmanager set can call raisepropertychanged(string.empty); update bindings.

2: when selectedmanager set can call raisepropertychanged("managername")); update binding specific property (but infact manager contains more properties have every property).

i don't think solution 1 , 2 clean solution 3 is:

creat innerclass detailsviewmodel (so basicly childviewmodel) handle details properties. bind datacontext of detail controls instance of detailsviewmodel. looks great solution, problem is, access parentviewmodel childviewmodel, , don't think passing parentviewmodel childviewmodel idea.

so cleanest solution, or there better way deal this?

screenshot of view: http://imageshack.com/a/img661/21/2xxws6.png


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -