Autogenerated Tiles
When you want the tiles of RadTileList to be automatically generated on the basis of a collection, use the ItemsSource property.
- Create a new class named Employee. The class' structure is shown on the next code-snippet.
Example 1: Defining the Employee class
- Once the class Employee is defined, we will define an EmployeeService class that will return an ObservableCollection, containing several hard-coded employees:
Example 2: Defining the EmployeeService class
- Set the ItemsSource property of RadTileList.
Example 3: Setting the ItemsSource property
Run your demo. The result should be similar to the next image:
The reason for this result is that the RadTileList "still doesn't know" how to display these business objects. You need to "say" explicitly what to be displayed. You can set a ItemTemplate.
- Create a DataTemplate and set it as a ItemTemplate.
Example 4: Setting the ItemTemplate
The result is shown on the next image:
When the ItemsSource is specified, Tiles containers are generated for each item in the collection. By using the AutoGeneratingTile event of RadTileList you can control the appearance and the look of the items in the collection.
As AutoGeneratingTile event is cancelable, you may reject the creation of a particular tile.
Example 5: Handling the AutoGeneratingTile event
The final result is shown on the next image: