SdTextInputLayout with input is Label not update Text, when binding new text to Label.

Hello !
I have used SfTextInputLayout with InputView as a Label. When I bind new data to Label. I checked that the label's Text property received the correct new value, but the UI displayed blank, without updating the Text to display. Is there any way to solve this problem?. In Xamarin.IOS. Thank you so much!

9 Replies 1 reply marked as answer

SS Sridevi Sivakumar Syncfusion Team August 5, 2020 02:55 PM UTC

Hi Son Hoang,

Greetings from Syncfusion.

We have checked your query and we would like to let you know that SfTextInputLayout accepts only the specific control as InputView of it.  Please find the supported input views 
 
  
UG link:   



SH Son Hoang August 6, 2020 06:57 AM UTC

Hello.
It is not natural that I have this question. The error only occurs in Xamarin.IOS. Xamarin.Android still works fine. I need a solution for Xamarin.IOS rather than saying you don't support. So why does Xamarin.Android work well?
Look forward to your answer.


RS Ramya Soundar Rajan Syncfusion Team August 7, 2020 12:41 PM UTC

 
As per your request, we have checked the reported issue by creating the simple sample to have a Label as InputView of SfTextInputLayout with having its Text property binding and dynamically changing that binding property which is worked fine at our end in all three platforms.   
  
For your information, even though that is not supported input view, due to the framework level support (suspected), it has been worked.   
  
Please find the sample and its output. 
 
 
 
Could you please share your use case like whether you have customized your application through theme support or please share the structure of SfTextInputLayout contains the page that will help to analysis your reported issue further and provide a possible solution earlier.   
 
Regards, 
Ramya S 



SH Son Hoang August 31, 2020 02:38 AM UTC

Hello, Ramya S.
I have created a demo so you can take a closer look at what I want to do.
I simply have a label, pressing this label will open a new page containing a list view.
When you click on any item on the listView, call Navigation.PopModalAsync ().
At OnDisappearing () function, check the text for the label.
You can check the demo for more clarity.
We look forward to answers and solutions, thank you very much.

Attachment: DemoSfTextInputLayout_46f89273.rar


SS Sridevi Sivakumar Syncfusion Team August 31, 2020 12:12 PM UTC

Hi Son Hoang,

We have checked the provided sample, updated combobox selected text to Label text has been updated as per the below code changes.


Code snippet:  
            Label label = new Label();  
            //label.Margin = new Thickness(5, 15, 5, 0);  
            label.SetBinding(Label.TextProperty, "ComboboxText");  
            label.Text = "Hoàng Nhật Sơn";  
  
            var tapGestureRecognizer = new TapGestureRecognizer();  
            tapGestureRecognizer.Tapped += (s, e) =>  
            {  
                cbxpage = new Combobox();  
                cbxpage.Example = this 
                //UserDialogs.Instance.Toast(et.Text != null ? et.Text : "");  
                Navigation.PushModalAsync(cbxpage, true).ConfigureAwait(true);  
            };  
            label.GestureRecognizers.Add(tapGestureRecognizer);  
  
            label.Focused += Label_Focused;  
  
            SfTextInputLayout inputLayout = new SfTextInputLayout { ContainerType = ContainerType.Outlined, OutlineCornerRadius = 3, Padding = new Thickness(0, 10, 0, 0) };  
            inputLayout.BindingContext = this 
            inputLayout.InputView = label;  
  
            this.Content = new StackLayout  
            {  
                Children = { inputLayout }  
            };  
        }  
  
        private void Label_Focused(object sender, FocusEventArgs e)  
        {  
            UserDialogs.Instance.Toast("Click");  
        }  
  
        public object ComboboxText  
        {  
            get { return GetValue(ComboboxTextProperty); }  
            set { SetValue(ComboboxTextProperty, value); }  
        }  
  
        public static readonly BindableProperty ComboboxTextProperty = BindableProperty.Create(propertyName: nameof(ComboboxText), returnType: typeof(string), declaringType: typeof(Example), defaultValue: "Hoàng Nhật Sơn", BindingMode.Default, propertyChanged: ComboboxTextChanged);  
  
        static void ComboboxTextChanged(BindableObject bindable, object oldValue, object newValue)  
        {  
            //bindable.SetValue(ComboboxControl., newValue);  
        }  
 



SH Son Hoang September 8, 2020 07:08 AM UTC

Hi Sridevi S .
Thanks for your feedback. I re-checked it today. 
I see the Sample you attached is not currently able to click ListView. 
I'm not sure what happened compared to the demo I sent you.

Currently I have the adjustment as you mentioned.
defaultValue: "Hoang Nhat Son" and BindingMode.Default with my old demo still archived.  the demo I submitted earlier has a shortcoming.
At "inputLayout", I need to add "Hint" to SfTextInputLayout. 
When adding "Hint". If you select Item on the ListView, the SfTextInputLayout will empty the data. 
I check, the Label inside has data that matches the data I just selected. I have attached a demo. Please check for me.
We look forward to hearing from you.

Attachment: DemoSfTextInputLayout_6b34373a.rar


RS Ramya Soundar Rajan Syncfusion Team September 10, 2020 01:11 PM UTC

Hi Son Hoang,  
  
We can confirm that the hint label is not animated while navigated to the text input layout hold page which having the Label as InputView in iOS.  
   
As we informed earlier, Label is not supported input view, due to the framework level support (suspected) in a platform-specific, it has been worked. In your provided sample setting value in the OnDisappearing method. So, control not getting focus when navigating back to the SfTextInputLayout. The hint will move on top when the control got focused state.  
   
So, we would like to suggest you use the Entry instead of Label by enabling IsReadOnly to behave like Label to resolve this problem. Please refer to the below code snippet.  
 
 
   … 
 
Entry entry = new Entry(); 
entry.SetBinding(Entry.TextProperty, "ComboboxText"); 
entry.IsReadOnly = true; 
entry.InputTransparent = true; 
 var tapGestureRecognizer = new TapGestureRecognizer(); 
tapGestureRecognizer.Tapped += (s, e) => 
 
         … 
 }; 
entry.GestureRecognizers.Add(tapGestureRecognizer); 
 
            SfTextInputLayout inputLayout = new SfTextInputLayout { ContainerType = ContainerType.Outlined, OutlineCornerRadius = 3, Padding = new Thickness(0, 10, 0, 0) }; 
inputLayout.BindingContext = this; 
            inputLayout.Hint = "This is label"; 
 
inputLayout.InputView = entry; 
   … 
 
 
 
Please check this solution and let us know.  
 
Regards, 
Ramya

Marked as answer

SH Son Hoang September 11, 2020 02:04 AM UTC

Hi Ramya.
Your solution was incredibly effective, working very well. Thank you very much.


SS Sridevi Sivakumar Syncfusion Team September 11, 2020 05:53 AM UTC

Hi Son Hoang,

Thanks for the update.

We are glad to know that the given solution works. Please let us know if you need any further assistance.

Regards,
Sridevi S. 
 


Loader.
Up arrow icon