You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 1, 2024. It is now read-only.
Xamarin Entry views are not working properly when using StringFormat in the binding configuration (e.g. 'F4') for a writable float property combined with an Android using a language other than US English (e.g. Portuguese Brazil).
Steps to Reproduce
Create a new AVD
-> I used Nexus S
-> API anything >= 25
-> +Google APIs (does not matter but I use it anyways)
Start the AVD and configure the language for Português Brasil as main language
-> Settings -> System -> Languages & Input -> Languages -> Add Language
-> Choose Português, then Brasil as "suggested"
-> Move the new language to top
Create a new Xamarin Forms project
-> Blank
-> Android (I don't have a Mac to test with iOS)
Update the solution's NuGet packages for the latest versions
-> NetStandard.Library v2.0.3
-> Xamarin.Essentials v1.5.1
-> Xamarin.Forms v4.5.0.495
Create a new ViewModel class in the Class Library project that implements INotifyPropertyChanged
The Entry view should display the value in the correct format specified in the Binding configuration regardless of the OS culture.
Actual Behavior
The Entry view is trying to format the value using the OS culture defined. This is causing a wrong parsing with the value.
Also, if the property is displayed more than one time, the value starts to increase.
-> Use read-only properties.
-> Use Mode=OneWay in binding configuration.
-> Using a property of a class that does not implement INotifyPropertyChanged is the same as accessing a read-only property.
The text was updated successfully, but these errors were encountered:
I'm able to run the reproduction but my screenshot doesn't match yours. Could you be more specific about the expected and actual values? Could you either generate screenshots of actual and expected values and/or quote the values you expect and see?
Hey @kingces95!
Using the test project, the expected value is "0,5670" for ALL Entry views.
The actual values are different depending the way the Entry binding was configured and which kind of property it was bound.
If you take a look at the screenshot I sent, the correct value was displayed only in the 2nd, 3rd and last Entry view.
I'm able to run the reproduction but my screenshot doesn't match yours.
You need to set the language in the AVD to pt-br (Portuguese Brazil) or in your development O.S to see in Android Previewer.
Description
Xamarin Entry views are not working properly when using StringFormat in the binding configuration (e.g. 'F4') for a writable float property combined with an Android using a language other than US English (e.g. Portuguese Brazil).
Steps to Reproduce
Create a new AVD
-> I used Nexus S
-> API anything >= 25
-> +Google APIs (does not matter but I use it anyways)
Start the AVD and configure the language for Português Brasil as main language
-> Settings -> System -> Languages & Input -> Languages -> Add Language
-> Choose Português, then Brasil as "suggested"
-> Move the new language to top
Create a new Xamarin Forms project
-> Blank
-> Android (I don't have a Mac to test with iOS)
Update the solution's NuGet packages for the latest versions
-> NetStandard.Library v2.0.3
-> Xamarin.Essentials v1.5.1
-> Xamarin.Forms v4.5.0.495
Create a new ViewModel class in the Class Library project that implements INotifyPropertyChanged
-> Include the ContextBinding configuration to use the created ViewModel class
-> Include an Entry and bind the Text property to the float property of the ViewModel class with a StringFormat
Expected Behavior
The Entry view should display the value in the correct format specified in the Binding configuration regardless of the OS culture.
Actual Behavior
The Entry view is trying to format the value using the OS culture defined. This is causing a wrong parsing with the value.
Also, if the property is displayed more than one time, the value starts to increase.
Basic Information
Screenshots
Android Previewer is also affected.
Reproduction Link
EntryFloatBug.zip
Workaround
-> Use read-only properties.
-> Use Mode=OneWay in binding configuration.
-> Using a property of a class that does not implement INotifyPropertyChanged is the same as accessing a read-only property.
The text was updated successfully, but these errors were encountered: