The Silverlight team decided to remove the ScrollBar control that used to be part of CoverFlow's control template. One of the reasons behind this decision is the easiness by which you can now, using Silverlight 3 element binding, create your own navigation. To learn more about all changes introduced by the beta version check my previous blog post here. This article explains in details how to create your own navigation using a range control, e.g. one that inherits from the RangeBase class.
The first thing we need to do is to declare a CoverFlow control with some items in a straight-forward manner.
To make things simpler you can either implement your own range control or choose among a ScrollBar, a RadNumericUpdown or a RadSlider. Using element binding you can easily associate the SelectedIndex of the CoverFlow to the value of your range control like this.
Now if you change the value of the slider control, the binding will also change the SelectedIndex of the CoverFlow control declared above. However, you also need to constraint the range from the Minimum possible index to the Maximum one. You can safely associate the Minimum value to zero, on the other hand the Maximum value needs some further consideration as your collections will vary in size. That is why, you need a binding that will always check the size of the collection and constraint the range control to it. The easiest way to do that is to create another binding that binds to the count of the items of your collection similar to this:
Note that if you use ItemsSource for binding you should substitute the Items.Count Path to ItemsSource.Count. However, property Count is not zero based value like the index array. Due to that, we will have an extra element available in our range. Unfortunately, there is no way you can tell the expression binding tto evaluate an expression that binds the property less a certain number, e.g. Items.Count -1. However, you can create a simple ValueConverter that can do the heavy lifting for you. Here is a simple int to int value converter that just sums the value and the converter parameter.
I hope this will alleviate some of the hassle cased by the lack of navigation in our new CoverFlow control. Stay tuned for all new things the Telerik team has prepared.
Hristo Borisov (@hristoborisov) is currently a product line manager in Telerik leading all cloud technologies part of the Telerik Platform after spending more than 6 years with the company. A passionate advocate of applying lean startup practices to existing organizations, Hristo is on the quest for discovering scalable and sustainable business models through product and customer development using tools like MVPs, Pivots, and Lean Business Model Canvases.
Subscribe to be the first to get our expert-written articles and tutorials for developers!