Derik Whittaker

Syndication

News


Using EventTriggers for DataRequested for RadJumpList

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:

  1. Set the DataVirtualizationMode value, in my case I wanted OnDemandAutomatic
  2. 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

image

Make sure you reference the namespace for System.Windows.Interactivity as below
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"

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,


Posted 01-30-2014 7:38 AM by Derik Whittaker
Filed under: , ,

[Advertisement]

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
Umbraco
NServiceBus
RavenDb
Web Sequence Diagrams
Ducksboard<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)