c# - How to bind the view to the VM wrapper instead of directly to the Model when multiple levels -
say have model structure this
being |_ person |_ billing address |_ customer |_ shipping addresses (collection) |_ etc.. |_ etc..
my view this
listbox (itemssource - bound vm wrapper of "being") - datatemplate containing listbox2 (itemssource - bound vm wrapper of "person") - datatemplate containing listbox3 (itemssource want bound "shipping adresses") problem!
im using mvvm light , locator, cannot figure out how third level - "shipping adresses" binding in third second datatemplate (listbox3). allows me bind shipping addresses collection in model directly. want in vm wrapper of customer, because need collection. code inner binding.
if understand model hierarchy, looks shipping address 4th level (unless mean being abstract or zero). should able dig each model's members so
<listbox itemssource="{binding being}"> <datatemplate> <listbox itemsource="{binding person}"> <datatemplate> <listbox itemsource="{binding customer}"> <datatemplate> <listbox itemsource="{binding shippingaddress}"/> </datatemplate> </listbox> </datatemplate> </listbox> </datatemplate> </listbox>
additionally, believe dot notation works in xaml on properties. try this
<listbox itemssource="{binding being}"> <datatemplate> <listbox itemsource="{binding person}"> <datatemplate> <listbox itemsource="{binding customer.shippingaddresses}"/> </datatemplate> </listbox> </datatemplate> </listbox>
if post code snippets, sure solution can found!
Comments
Post a Comment