If you have already read the Getting Started page, you know how to add RadListView instance to your project and populate it with data. This section will demonstrate how to add different behaviors to the list view instance that we have created.
The list view behaviors can be used for efficient handling of gestures by RadListView. Each behavior handles different gestures in order to provide intuitive response. For example, when the long press gesture is detected, SelectionBehavior will select the item that was long pressed. A behavior can be added to a list view instance through the addBehavior(ListViewBehavior) method and removed through removeBehavior(ListViewBehavior). Additionally you can remove all currently added behaviors with clearBehaviors(). Here's an example of adding the LoadOnDemandBehavior to a list view instance:
LoadOnDemandBehavior loadOnDemandBehavior = new LoadOnDemandBehavior (); listView.AddBehavior (loadOnDemandBehavior);
For now, what this will do, is to add a button at the end of the list that can be used by the end user to request loading of more items. You can have a look at the dedicated page for the LoadOnDemandBehavior to see how to actually load more items when the button is clicked. Here's the list of the behaviors that are currently available:
- Selection: This behavior allows the end users to select items in the list.
- Item Reorder: This behavior allows the end users to change the order of the items in the list.
- Load on Demand: This behavior allows you to load a few items at first and load more only if necessary.
- Swipe to Refresh: This behavior allows the end users to reload the items in the list to see if the information is updated.
- Swipe to Execute: This behavior allows the end users to swipe an item and remove it from the list or execute another predefined command.
- Sticky Headers: This behavior can be used when grouping is enabled to force the header of the first item to remain visible after it is scrolled away.
- Collapsible Groups: This behavior can be used when grouping is enabled to allow the users to collapse or expand the groups by tapping on their header.