Issue
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?
Solution
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
Answered By - Jason
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.