Hi Erlend,
Thanks for your patience.
Query 1 : SendMessage event handled documentation is wrong.
We have checked your application and we saw that you have added the message to Message collection after setting e.handled set to true. So, only the new message is reflected to SfChat conversation. Please don’t add the new message to the collection when e.handled is set as true. Also, we applied e.handled as false and checked the behavior, new the message is added to the collection and reflected back to SfChat conversion as expected.
Query 2: Editor control doesn’t clear out the text and overriding it with ChatView.Editor.Text = string.Empty doesn’t do anything until a new item is added to the list.
In current implemention of SfChat, we cleared the editor text after the new message is added to the collection. So only the text is not clear until a new message is added to the conversation. If you want clear the text when e.handled set as true put delay as 100 milliseconds because we are maintaining the editor text after the SendMessage event completed in our source.
Query 3 : The keyboard automatically collapses on Android after a new message has been added to the collection even if SetKeyboardAlways is set to true.
This property is not applicable for the Android platform and the keyboard will be hidden after a message is sent or when the focus is lost. Refer the below workaround to show the keyboard always in the android platform.
In the MainActivity.cs of your Xamarin.Forms.Android project, override the CurrentFocus property and in its getter, if SfChatRenderer.IsChatEditorFocused() method returns true, then return null, else return base.CurrentFocus as shown below.
Code snippet :
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity { ... public override View CurrentFocus { get { if (SfChatRenderer.IsChatEditorFocused(base.CurrentFocus)) { return null; } return base.CurrentFocus; } } ... } |
Query 5 : The background color of the input field and rounded border (corner radius) cannot be overridden.
Please refer to the below workaround for both requirements.
Code snippet :
|
.. SfBorder border;
…
var listview = (SfListView)ChatView.GetType().GetRuntimeProperties().FirstOrDefault(x => x.Name.Equals("ChatListView")).GetValue(ChatView);
listview.Loaded += Listview_Loaded;
FooterView footerView = (FooterView)(this.ChatView.Content as Grid).Children[1];
ContentView contentView = (ContentView)(footerView as Grid).Children[1];
border = (contentView.Content as SfBorder);
border.BackgroundColor = Color.LightGray;
(border.Content as Grid).BackgroundColor = Color.LightGray;
((border.Content as Grid).Children[0] as Editor).BackgroundColor = Color.LightGray;
…. private void Listview_Loaded(object sender, ListViewLoadedEventArgs e)
{
border.CornerRadius = new Thickness(5, 5, 5, 5);
} |
Regarding Query 4 and Query 6, we need some more time to validate the reported issues. So, we will validate and update you further details on or before 7th Sep 2020. We appreciate your patience until then.
Regards,
Karthik Raja