Dynamically adding Views in Silverlight & MVVM
- by dvox
Hi all,
I am starting to re-write my whole silverlight business application in the MVVM pattern;
My first stop-point is this:
I have a page (View1) with corresponding ViewModel1 (with a property 'IEnumerable AllData');
Now, within this View, I want to have i.e. a tree-view control, in which one node will be populated with another View2;
My question is:
1. How to do it?
- I can't loop through the AllData property since it is asynchronously loaded...
- thus I don't know the number of View2s' to insert
- I don't know how to do it from ViewModel1 :(
Will I need ViewModel2 with property 'MyDataEntity CurrentData'?
or I can bind to AllData property from ViewModel1
Can you help me out?
Thanks