Skip to content

How to remove a thousand separators in the numeric text field in Xamarin.Forms DataForm (SfDataForm)

Notifications You must be signed in to change notification settings

SyncfusionExamples/numeric-editor-group-separator-dataform-xamarin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

How to remove a thousand separators in the numeric text field in Xamarin.Forms DataForm (SfDataForm)

You can disabled the thousand seperators for numeric editor in Xamarin.Forms SfDataForm by using EnableGroupSeparator property.

Refer to the online user guide documentation for customize the editor in DataForm using AutoGeneratingDataFormItem event.

You can also refer to the following article.

https://www.syncfusion.com/kb/11527/how-to-remove-a-thousand-separators-in-the-numeric-text-field-in-xamarin-forms-dataform

C#

Set the EnableGroupSeparator property into false inside the AutoGeneratingDataFormItem event.

public class DataFormBehavior : Behavior<ContentPage>
    {
        SfDataForm dataForm;
        protected override void OnAttachedTo(ContentPage bindable)
        {
            base.OnAttachedTo(bindable);
            dataForm = bindable.FindByName<SfDataForm>("dataForm");
            dataForm.AutoGeneratingDataFormItem += DataForm_AutoGeneratingDataFormItem;
        }
        private void DataForm_AutoGeneratingDataFormItem(object sender, AutoGeneratingDataFormItemEventArgs e)
        {
            if (e.DataFormItem != null)
            {
                if (e.DataFormItem.Name == "BirthYear")
                {
                    (e.DataFormItem as DataFormNumericItem).EnableGroupSeparator = false;
                }
            }
        }
        protected override void OnDetachingFrom(ContentPage bindable)
        {
            base.OnDetachingFrom(bindable);
            dataForm.AutoGeneratingDataFormItem -= DataForm_AutoGeneratingDataFormItem;
        }
  }

About

How to remove a thousand separators in the numeric text field in Xamarin.Forms DataForm (SfDataForm)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages