Data Binding to Collection
This article shows how to use RadChat in MVVM scenario by data binding its items source to a collection of view models.
To data bind the messages list you can use the DataSource and MessageConverter properties of the RadChat control.
The DataSource property expects a collection of business objects containing information about the messages.
The MessageConverter allows you to use an implementation of the IMessageConverter interface. This is used to convert between the business object models and the RadChat message models. The ConvertItem method should convert a business object to a message object and ConvertMessage should convert a message object to a business object.
The following example shows how to define custom models and use the converter.
Example 1: Defining the messages view model
Example 2: Defining the main view model and populating the data source with data
Example 3: Implementing message converter
Example 4: Setting up the RadChat control
The example demonstrates how to work with text messages, but the same approach is also applicable for the other message types.