Telerik blogs

Some time ago a customer of ours asked us if there is a possibility to use the FilterDescriptors, SortDescriptors and GroupDescriptors collection in a MVVM context by binding them to collections defined by the view model. As all the data is managed there, why not also manage the data operations in the same class? Unfortunately, these three properties are readonly and therefore binding them to a property defined by the main view model wouldn’t work.

We decided that allowing similar scenarios will simplify the development with RadJumpList and therefore as of Q3 2011 SP1 the control exposes three new properties which are as follows:

  • FilterDescriptorsSource
  • SortDescriptorsSource
  • GroupDescriptorsSource

 

All of them accept values of the IEnumerable<DataDescriptor> type and are dependency properties. You can use these properties in XAML binding expressions with properties exposed by the view-model, just as you would bind the Text property of a TextBlock to a property of the source object. So, in case we have a GroupDescriptors property defined on our main view model set as a DataContext to our page, we will be able to bind this group descriptor collection to the GroupDescriptorsSource in the following way:

 

<telerikDataControls:RadJumpList GroupDescriptorsSource={Binding GroupDescriptors} x:Name="radJumpList"/>

There are, however, a couple of important rules to follow here. When RadJumpList has one of its DataDescriptor collections bound to a view-model source, i.e. is in bound mode, adding items to this collection directly would cause an InvalidOperationException. This will also be the case when binding one of these properties to a source on the view-model provided that there are already items in the corresponding Data Descriptor collection.

To check out this new feature in RadJumpList go and download RadControls for Windows Phone 7 Q3 2011 SP1 and share with us your feedback!


Deyan Ginev
About the Author

Deyan Ginev

Deyan has been with Telerik for more than ​six years working on several different products with main focus on mobile technologies. Deyan is currently working on NativeScript– a platform for developing native mobile apps with JavaScript. Find him on Twitter via
@deyan_ginev.

Comments

Comments are disabled in preview mode.