Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Editor Control Bug? Binding to Text Property

$
0
0

I believe I found a bug with the Editor Control in Xamarin.Forms. I'm using the XAML approach, so I'm not sure if the issue also exists when binding programatically.

When binding to the Text property of the Editor control, the viewModel value is set to an empty string before retrieving the value and binding the Text property to the viewModel value. The text value is always empty in the editor initially on page load because of this, even if the viewModel property originally had a value.

When I change the Editor control to an Entry control, the binding all works properly and displays the correct ViewModel property value and does not assign to empty string initially.

Here is my example I tested:
In my TestClass.xaml.cs file I set:
this.BindingContext = new ViewModelTest{Notes = "Here are some notes to show."};
(Notes is a string property, ViewModelTest implements INotifyPropertyChanged)

In my TestClass.xaml file I set:
<Editor Text="{Binding Notes}" />

When I do this, the Editor control does not show my message filled in as "Here are some notes to show." on page appear.

However, when I use the entry control instead it works and displays my note in the entry control on page appear:
<Entry Text="{Binding Notes}" />

I believe I have a workaround I will try for now in the Editor control to reassign the value from the ViewModel to the control after the binding process completes.

Let me know if you can duplicate/verify the issue I posted. If it is a legitimate bug, do you know when a fix should come out approximately?


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>