Customise Editor Placeholder

Hi,

Is there a way to customise the send message placeholder text?

We tried to do the following:

            sfChat.Editor.Placeholder = "Type your reflective question here";

But when the page is rendered, the placeholder seems to revert back to "Type a message"

Thanks

6 Replies 1 reply marked as answer

FP Farjana Parveen Ayubb Syncfusion Team June 10, 2020 03:40 AM UTC

Hi Malcolm, 
 
Thank you for using Syncfusion controls. 
 
Currently we are working on this with high priority, we will provide the further details on or before 11th June 2020. 
 
Regards, 
Farjana Parveen A 



KK Karthikraja Kalaimani Syncfusion Team June 12, 2020 02:23 PM UTC

Hi Malcolm,

Thanks for your patience.

We can change the Placeholder text for Editor view on loaded event of the SfListView. Please refer the below code snippet to achieve your requirement.

Code snippet,

 
………
(((this.sfChat as ContentView).Content as Grid).Children[0] as SfListView).Loaded += ListView_Loaded;
…………

 
private void ListView_Loaded(object sender, ListViewLoadedEventArgs e) 
 { 
            var footerView = (Grid)this.sfChat.GetType().GetRuntimeProperties().FirstOrDefault(x => x.Name.Equals("FooterView")).GetValue(this.sfChat); 
            ((((footerView.Children[1] as ContentView).Content as SfBorder).Content as Grid).Children[0] as Editor).Placeholder = "Type your reflective question here"; 
 } 



SH Shylaja December 5, 2020 01:56 PM UTC

This didnt work,  I had to use the below code to modify the placeholder of Sfchat editor.

(((((footerView.Children[1] as ContentView).Content as SfBorder).Content as Grid).Children[0] as Grid).Children[0] as Editor).Placeholder = "Say Something"


KK Karthikraja Kalaimani Syncfusion Team December 7, 2020 05:16 AM UTC

 
Hi Shylaja,

We suspect that you have tried to change the placeholder text on after initializing the SfChat. So, only it not changed. So implement that code on ListView loaded event to change the placeholder text. If you still facing the  same issue ? please let us know the SfChat and Xamarin Forms versions. Because it will help us to provide a better solution earlier.

Regards,
 
Karthik Raja 



VA Vassili replied to Karthikraja Kalaimani May 30, 2021 03:51 PM UTC

 
Hi Shylaja,

We suspect that you have tried to change the placeholder text on after initializing the SfChat. So, only it not changed. So implement that code on ListView loaded event to change the placeholder text. If you still facing the  same issue ? please let us know the SfChat and Xamarin Forms versions. Because it will help us to provide a better solution earlier.

Regards,
 
Karthik Raja 


Looks like now the SfChat structure has changed. So this doesn't work anymore:

((((footerView.Children[1] as ContentView).Content as SfBorder).Content as Grid).Children[0] as Editor).Placeholder = "Type your reflective question here"; 

This works instead (there is an extra Grid inside of a Grid):

 (((((footerView.Children[1] as ContentView).Content as SfBorder).Content as Grid).Children[0] as Grid).Children[0] as Editor).Placeholder = "Type your reflective question here"; 

The solution looks fragile and depending on consequent releases that might change the SfChat structure again.
Is there a better solution now?

Thanks!


RK Ranjith Kumar Durairaj Syncfusion Team May 31, 2021 11:59 AM UTC

Hi Malcolm van Staden 
Please ignore the previous updates since it is a hectic process to reflect footerview to  achieve the requirement.
We suspect that you have tried to change the placeholder text before the SfChat.Editor gets rendered. So please implement the code in "Sfchat.Editor PropertyChanged" event as mentioned below,


 
        public SimpleChatPage() 
        { 
            InitializeComponent(); 
            sfChat.Editor.PropertyChanged += Editor_PropertyChanged; 
        } 


 
        private void Editor_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) 
        { 
            if(e.PropertyName == "Placeholder") 
            { 
                sfChat.Editor.Placeholder = "Type your reflective question here"; 
            } 
        } 

Regards,
Ranjith Kumar


Marked as answer
Loader.
Up arrow icon