Silverlight MVVM Async Lazy Loading Example

Silverlight MVVM Async Lazy Loading Example

Old forum URL: forums.lhotka.net/forums/t/10316.aspx


thaehn posted on Thursday, April 28, 2011

Is there an example of how to lazy load data using the MVVM model explained in the video series  (SIDemo app)?  Specifically, I don't know how to trigger the loading of the data (a grid inside another grid) when the row becomes active and how to set up the view model.

Todd

tiago replied on Thursday, April 28, 2011

Hi Todd,

Async LazyLoad is Async LazyLoad, Silverlight or no Silverlight. Have a look at this thread

http://forums.lhotka.net/forums/p/10238/48000.aspx#48000

thaehn replied on Thursday, April 28, 2011

I have already done that.  I need to know how to implement it in BXF using the ViewModel.

Todd

thaehn replied on Friday, April 29, 2011

Althoug it isn't working 100% yet, this has got me most of the way there.  I draged a reference to the child property from the datasources to create a grid.  I then copied the ItemSource property from that new grid and removed the automatically created grid from the XAML. The drag and drop also created the CollectionViewSource that I needed as well. 

When I click on a row it fetches the data for that row and by clicking on the "+" It displays correctly in the tab.  When I click on another row, it fetches that data, but the previous tab now shows the newly fetched data for the row that I just clicked on. The data template is showing the data for the current row, no matter what row I am displaying the data in. 

I also get a fetch of data every time I click on a row, it doesn't seem to retain the data already fetched. 

These are minor problems that I am sure that I can work through.

Todd

Copyright (c) Marimer LLC