Does the SfChat
control for Xamarin Forms require specific properties for Messages
?
In my model, I do have the ObservableCollection<MessageModel> messages
property to handle messages but the properties of my MessageModel
are different than what's in the getting started documentation. Do they need to match e.g. Author
, Text
, etc? For example, in my model, the property is not named Author
but Sender
. Another one is Text
property. In my model it's named Body
.
Currently when I run the code, I'm getting the following error:
System.InvalidCastException: 'Object must implement IConvertible.'
I do recognize this error which is thrown if I don't bind properties of my model to the control correctly. Any suggestions as to how to properly bind properties of my model to the control or do I need to make sure property names are exactly what the control expects?
CodePudding user response:
the docs seem to cover this
The IChatMessageConverter interface provides the methods ConvertToChatMessage and ConvertToData to convert an item of an existing collection to a chat message and to convert a chat message to an item of the existing data collection respectively.
you need to provide a IChatMessageConverter
that will convert your class to and from the SF data format