menu

MAUI

  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class DataFormViewItem - MAUI API Reference | Syncfusion

    Show / Hide Table of Contents

    Class DataFormViewItem

    Represents the base class that encapsulates the layout, group and editor setting for a data fields appearing in DataForm.

    Inheritance
    System.Object
    DataFormViewItem
    DataFormGroupItem
    DataFormItem
    Namespace: Syncfusion.Maui.DataForm
    Assembly: Syncfusion.Maui.DataForm.dll
    Syntax
    public abstract class DataFormViewItem : Element

    Constructors

    DataFormViewItem()

    Initializes a new instance of the DataFormViewItem class.

    Declaration
    protected DataFormViewItem()

    Fields

    ColumnSpanProperty

    Identifies the ColumnSpan dependency property.

    Declaration
    public static readonly BindableProperty ColumnSpanProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for ColumnSpan dependency property.

    IsVisibleProperty

    Identifies the IsVisible dependency property.

    Declaration
    public static readonly BindableProperty IsVisibleProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for IsVisible dependency property.

    PaddingProperty

    Identifies the Padding dependency property.

    Declaration
    public static readonly BindableProperty PaddingProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for Padding dependency property.

    RowOrderProperty

    Identifies the RowOrder dependency property.

    Declaration
    public static readonly BindableProperty RowOrderProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for RowOrder dependency property.

    RowSpanProperty

    Identifies the RowSpan dependency property.

    Declaration
    public static readonly BindableProperty RowSpanProperty
    Field Value
    Type Description
    Microsoft.Maui.Controls.BindableProperty

    The identifier for RowSpan dependency property.

    Properties

    ColumnSpan

    Gets or sets the number of column that this item spans to increase item's width.

    Declaration
    public int ColumnSpan { get; set; }
    Property Value
    Type Description
    System.Int32

    The default value is 1.

    Remarks

    Items on the data form are arranged in layout columns. Use the RowOrder property to specify the number of the layout row where the item should be displayed.

    Examples

    The below examples shows, how to use the ColumnSpan property of DataFormViewItem in the SfDataForm.

    • XAML
    • C#
    • C#
    • C#
    • C#
    <dataForm:SfDataForm x:Name="dataForm">
    </dataForm:SfDataForm>
    public class DataFormViewModel
    {
      public AccountInfo AccountInfo { get;set; }
    }
    public class AccountInfo
    {
       public string UserName { get; set; }
       [DataType(DataType.Password)]
       public string Password { get; set; }
    }
    this.dataForm.DataObject = new DataFormViewModel().AccountInfo;
    this.dataForm.GenerateDataFormItem += OnDataFormGenerateDataFormItem;
    private void OnDataFormGenerateDataFormItem(object sender, GenerateDataFormItemEventArgs e)
    {
       if (e.DataFormItem != null)
       {
          e.DataFormItem.ColumnSpan = 2;
       }
    }
    this.dataForm.AutoGenerateItems = false;
    var items = new ObservableCollection<DataFormViewItem>();
    items.Add(new DataFormTextItem() { FieldName = "UserName", ColumnSpan = 2 });
    items.Add(new DataFormPasswordItem() { FieldName = "Password", ColumnSpan = 2 });
    this.dataForm.Items = items;
    See Also
    RowSpan
    RowOrder
    ItemsOrderInRow

    IsVisible

    Gets or sets a value indicating whether the data form item layout (Holds editor and label) is visible or not.

    Declaration
    public bool IsVisible { get; set; }
    Property Value
    Type Description
    System.Boolean

    The default value is true.

    Examples

    The below examples shows, how to use the IsVisible property of DataFormViewItem in the SfDataForm.

    • XAML
    • C#
    • C#
    • C#
    • C#
    <dataForm:SfDataForm x:Name="dataForm">
    </dataForm:SfDataForm>
    public class DataFormViewModel
    {
      public AccountInfo AccountInfo { get;set; }
    }
    public class AccountInfo
    {
       public string UserName { get; set; }
       [DataType(DataType.Password)]
       public string Password { get; set; }
    }
    this.dataForm.DataObject = new DataFormViewModel().AccountInfo;
    this.dataForm.GenerateDataFormItem += OnDataFormGenerateDataFormItem;
    private void OnDataFormGenerateDataFormItem(object sender, GenerateDataFormItemEventArgs e)
    {
       if (e.DataFormItem != null && e.DataFormItem.FieldName == "UserName")
       {
          e.DataFormItem.IsVisible = false;
       }
    }
    this.dataForm.AutoGenerateItems = false;
    var items = new ObservableCollection<DataFormViewItem>();
    items.Add(new DataFormTextItem() { FieldName = "UserName", IsVisible=false });
    items.Add(new DataFormPasswordItem() { FieldName = "Password" });
    this.dataForm.Items = items;
    See Also
    RowSpan
    RowOrder
    ColumnSpan
    ItemsOrderInRow

    Padding

    Gets or sets the space between the data form item’s editor and label.

    Declaration
    public Thickness Padding { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Thickness

    The default value is 10.

    Examples

    The below examples shows, how to use the Padding property of DataFormViewItem in the SfDataForm.

    • XAML
    • C#
    • C#
    • C#
    • C#
    <dataForm:SfDataForm x:Name="dataForm">
    </dataForm:SfDataForm>
    public class DataFormViewModel
    {
       public AccountInfo AccountInfo { get;set; }
    }
    public class AccountInfo
    {
       public string UserName { get; set; }
       [DataType(DataType.Password)]
       public string Password { get; set; }
    }
    this.dataForm.DataObject = new DataFormViewModel().AccountInfo;
    this.dataForm.GenerateDataFormItem += OnDataFormGenerateDataFormItem;
    private void OnDataFormGenerateDataFormItem(object sender, GenerateDataFormItemEventArgs e)
    {
       if (e.DataFormItem != null)
       {
          e.DataFormItem.Padding = new Thickness(20);
       }
    }
    this.dataForm.AutoGenerateItems = false;
    var items = new ObservableCollection<DataFormViewItem>();
    items.Add(new DataFormTextItem() { FieldName = "UserName", Padding = new Thickness(20) });
    items.Add(new DataFormPasswordItem() { FieldName = "Password", Padding = new Thickness(20) });
    this.dataForm.Items = items;
    See Also
    RowSpan
    ColumnSpan
    RowOrder
    ItemsOrderInRow
    IsVisible

    RowOrder

    Gets or sets the row order of the editor in the data form.

    Declaration
    public int RowOrder { get; set; }
    Property Value
    Type Description
    System.Int32

    The default value is -1.

    Remarks

    Data form editors are arranged in rows, use the RowOrder property to specify the row order where the editor should be displayed.

    Examples

    The below examples shows, how to use the RowOrder property of DataFormViewItem in the SfDataForm.

    • XAML
    • C#
    • C#
    • C#
    • C#
    <dataForm:SfDataForm x:Name="dataForm">
    </dataForm:SfDataForm>
    public class DataFormViewModel
    {
       public AccountInfo AccountInfo { get;set; }
    }
    public class AccountInfo
    {
       [DataType(DataType.Password)]
       public string Password { get; set; }
       public string UserName { get; set; }
    }
    this.dataForm.DataObject = new DataFormViewModel().AccountInfo;
    this.dataForm.GenerateDataFormItem += OnDataFormGenerateDataFormItem;
    private void OnDataFormGenerateDataFormItem(object sender, GenerateDataFormItemEventArgs e)
    {
       if (e.DataFormItem != null)
       {
          if (e.DataFormItem.FieldName == "UserName")
          {
             e.DataFormItem.RowOrder = 1;
          }
          else
          {
             e.DataFormItem.RowOrder = 2;
          }
       }
    }
    this.dataForm.AutoGenerateItems = false;
    var items = new ObservableCollection<DataFormViewItem>();
    items.Add(new DataFormPasswordItem() { FieldName = "Password", RowOrder = 2 });
    items.Add(new DataFormTextItem() { FieldName = "UserName", RowOrder = 1 });
    this.dataForm.Items = items;
    See Also
    RowSpan
    ColumnSpan
    ItemsOrderInRow

    RowSpan

    Gets or sets the number of rows that this item spans which is used to increase item's height.

    Declaration
    public int RowSpan { get; set; }
    Property Value
    Type Description
    System.Int32

    The default value is 1.

    Remarks

    Items on the data form are arranged in layout rows. Use the RowOrder property to specify the number of the layout row where the item should be displayed.

    Examples

    The below examples shows, how to use the RowSpan property of DataFormViewItem in the SfDataForm.

    • XAML
    • C#
    • C#
    • C#
    • C#
    <dataForm:SfDataForm x:Name="dataForm">
    </dataForm:SfDataForm>
    public class DataFormViewModel
    {
       public AccountInfo AccountInfo { get;set; }
    }
    public class AccountInfo
    {
       public string UserName { get; set; }
       [DataType(DataType.Password)]
       public string Password { get; set; }
    }
    this.dataForm.DataObject = new DataFormViewModel().AccountInfo;
    this.dataForm.GenerateDataFormItem += OnDataFormGenerateDataFormItem;
    private void OnDataFormGenerateDataFormItem(object sender, GenerateDataFormItemEventArgs e)
    {
       if (e.DataFormItem != null)
       {
          e.DataFormItem.RowSpan = 2;
       }
    }
    this.dataForm.AutoGenerateItems = false;
    var items = new ObservableCollection<DataFormViewItem>();
    items.Add(new DataFormTextItem() { FieldName = "UserName", RowSpan = 2 });
    items.Add(new DataFormPasswordItem() { FieldName = "Password", RowSpan = 2 });
    this.dataForm.Items = items;
    See Also
    ColumnSpan
    RowOrder
    ItemsOrderInRow

    Methods

    OnPropertyChanged(String)

    Declaration
    protected override void OnPropertyChanged(string propertyName = null)
    Parameters
    Type Name Description
    System.String propertyName
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved