- Home
- Forum
- Xamarin.Forms
- Hint layout incorrect on SfTextInputLayout when using SfNumericTextBox InputView
Hint layout incorrect on SfTextInputLayout when using SfNumericTextBox InputView
I am using a SfNumericTextBox InputView on a SfTextInputLayout. I also reduced the InputViewPadding. The hint is not properly aligned when the form is first rendered. After clicking in the SfTextInputLayout and then clicking elsewhere the hint is aligned, but not on first appearance. Any suggestions?
I am pasting the code below.
var balance = new SfNumericTextBox()
{
TabIndex = 4,
AllowNull = true,
BorderColor = Color.Transparent,
FormatString = "c",
ReturnType = ReturnType.Next,
ReturnCommand = new CoreCommand((obj)=>
{
TxtNotes.Focus();
})
};
var txtBalance = new SfTextInputLayout
{
Hint = AppResources.Balance,
IsVisible = true,
InputView = balance,
InputViewPadding = new Thickness(0,5),
Margin = new Thickness(0,10,0,0),
ContainerBackgroundColor = Color.Transparent,
};
I have duplicated the issue in the attached solution. The issue occurs when using a hint bound to a Resx field. The balance hint should be left aligned like it is after clicking on the balance field and then losing focus on that field.
Second question, is there anyway to auto format currency as the user types? For example if they type a 1 the entry would display 0,01 or 0.01 depending on the culture. Then if they type 2 the entry would update to 0,12 or 0.12 depending on the culture. I tried using valuechanged on the SfNumericTextBox, but was unable to get the desired result.
Regards,
Seth
Attachment: SfTextInputLayout_a0c1193f.zip
Hi Eswaran,
Thanks for the sample code in query 2. I tried it and it only formatted the currency on unfocus. I was hoping to format the currency while typing. I tried to modify the example, but couldn't get it to work.
I did achieve the desired result using an entry control. It will format any decimal while typing and will display the currency on the unfocused event. It would be nice if this type of functionality was baked into the SfNumericTextBox control.
Also, there may be room for improving my sample code if you see anything?
Thanks,
Seth
Attachment: NumericTextBox_Sample_5587ead4.zip
Thanks for your patience.
We checked the requirement with the provided sample and are happy to report that we were meet your requirements by using the ValueChanged event and the Validation mode as OnKeyFocus. For the UWP platform, the logic works perfectly. However, when altering the value in the value changed event on the Android and iOS platforms, the cursor is positioned incorrectly for the first digit only. As a result, we've classified this as an internal bug, and the fix will be included in the next weekly NuGet, which will be scheduled to release on December 21, 2021. We appreciate your patience until then. Please get the modified sample from the link below.
https://www.syncfusion.com/downloads/support/directtrac/general/ze/NumericTextBox_Sample-1008537297
Regards,
Eswaran.
- 9 Replies
- 2 Participants
-
SU Seth U Starr
- Nov 30, 2021 03:54 PM UTC
- Dec 28, 2021 01:48 PM UTC