Hello,
Welcome to our Microsoft Q&A platform!
You can try to use following code
<Entry TextChanged="Entry_TextChanged"></Entry>
private void Entry_TextChanged(object sender, TextChangedEventArgs e)
{
var textbox = (Entry)sender;
var tempValue = double.Parse(textbox.Text, CultureInfo.InvariantCulture);
var newFormat = tempValue.ToString("N2", CultureInfo.InvariantCulture);
textbox.Text = newFormat;
textbox.CursorPosition = newFormat.Length - 3;
}
Here is running screenshot.
====================
Update ===========================
I use Completed
to achieve it.
<Entry Keyboard="Numeric" HorizontalOptions="FillAndExpand" Completed="Entry_Completed"></Entry>
private void Entry_Completed(object sender, EventArgs e)
{
// var entry = sender as Entry;
var textbox = (Entry)sender;
var tempValue = double.Parse(textbox.Text, CultureInfo.InvariantCulture);
var newFormat = tempValue.ToString("N2", CultureInfo.InvariantCulture);
textbox.Text = newFormat;
}
If you click the complete button like following screenshot, then number will be changed
Best Regards,
Leon Lu
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.