I am a fan of MVVM and I buy into the idea NOT using code behind it at all possible. When using the Telerik RadJumpList (or anything based off of DataBoundListBox) there is a feature that you can enable which will all you to provide ‘infinite’ scroll ability to a list box which could contain virtually unlimited items.
Typically when you implement this behavior you need to do 2 things:
- Set the DataVirtualizationMode value, in my case I wanted OnDemandAutomatic
- Create an event handler in your views code behind to listen to the DataRequested event.
I have no ‘MVVM’ issues w/ the DataVirtualizationMode value being hard wired, but I really do not like the idea of having an event handler in my Code behind whos only job it is, is to call a method on my view model. Fortunately for use we can solve this problem with ease by using EventTriggers.
Take a look at the xaml below for an example on how to accomplish this
Make sure you reference the namespace for System.Windows.Interactivity as below
Once you use this event trigger you can create a ICommand property on your ViewModel and avoid your code behind.
Hope this helps!
Till next time,
01-30-2014 7:38 AM