Editor Width in DataForm

How do I set the width of a text editor when using .NET Maui SfDataForm?

  I want the actual width of the TextEditor box to be 30 when the column width is 100

  [Display(GroupName = "Data")]
  public string Username { get; set; }


  [Display(GroupName = "Data")]
  public string Password { get; set; }


  [Display(Name = "First Name", GroupName = "Data")]
  public string FName { get; set; }


  [Display(Name = "Middle Name", GroupName = "Data")]
//Here I want the actual width of the TextEditor box to be 30 when the column width is 1000


  public string MName { get; set; }


  [Display(Name = "Last Name", GroupName = "Data")]
  public string LName { get; set; }

1 Reply

SS SaiGanesh Sakthivel Syncfusion Team December 27, 2023 12:03 PM UTC

Hi Frederick,


#Query 1: Regarding changing the editor width for the SfDataForm

We have documented ‘How to change the editor width in the SfDataForm’ in our user guidance document. Please refer to the following UG documentation for your reference.


Link: https://help.syncfusion.com/maui/dataform/dataform-settings#change-editor-layout-settings


Please refer to the code snippet for your reference.


private void dataForm_GenerateDataFormItem(object sender, Syncfusion.Maui.DataForm.GenerateDataFormItemEventArgs e)

{

    if (e.DataFormItem != null)

    {

        if (e.DataFormItem.FieldName == "LastName")

        {

            e.DataFormItem.DefaultLayoutSettings = new DataFormDefaultLayoutSettings();

            e.DataFormItem.DefaultLayoutSettings.EditorWidth = 400;

        }

    }

}


Please let us know if you have any concerns.


Regards,
SaiGanesh Sakthivel


Loader.
Up arrow icon