MAUI

  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class DataFormGroupItem

    Show / Hide Table of Contents

    Class DataFormGroupItem

    Represents the class to encapsulates the group settings for group of data field's appearing in DataForm.

    Inheritance
    System.Object
    DataFormViewItem
    DataFormGroupItem
    Inherited Members
    DataFormViewItem.RowSpanProperty
    DataFormViewItem.ColumnSpanProperty
    DataFormViewItem.IsVisibleProperty
    DataFormViewItem.RowOrderProperty
    DataFormViewItem.PaddingProperty
    DataFormViewItem.OnPropertyChanged(String)
    DataFormViewItem.RowSpan
    DataFormViewItem.ColumnSpan
    DataFormViewItem.IsVisible
    DataFormViewItem.RowOrder
    DataFormViewItem.Padding
    Namespace: Syncfusion.Maui.DataForm
    Assembly: Syncfusion.Maui.DataForm.dll
    Syntax
    public class DataFormGroupItem : DataFormViewItem

    Constructors

    DataFormGroupItem()

    Initializes a new instance of the DataFormGroupItem class.

    Declaration
    public DataFormGroupItem()

    Fields

    AllowExpandCollapseProperty

    Identifies the AllowExpandCollapse dependency property.

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

    The identifier for AllowExpandCollapse dependency property.

    ColumnCountProperty

    Identifies the ColumnCount dependency property.

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

    The identifier for ColumnCount dependency property.

    HeaderBackgroundProperty

    Identifies the HeaderBackground dependency property.

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

    The identifier for HeaderBackground dependency property.

    HeaderTextStyleProperty

    Identifies the HeaderTextStyle dependency property.

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

    The identifier for HeaderTextStyle dependency property.

    IsExpandedProperty

    Identifies the IsExpanded dependency property.

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

    The identifier for IsExpanded dependency property.

    ItemsPaddingProperty

    Identifies the ItemsPadding dependency property.

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

    The identifier for ItemsPadding dependency property.

    ItemsProperty

    Identifies the Items dependency property.

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

    The identifier for Items dependency property.

    NameProperty

    Identifies the Name dependency property.

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

    The identifier for Name dependency property.

    Properties

    AllowExpandCollapse

    Gets or sets a value indicating whether users can collapse and expand the group of editors.

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

    The default value is true.

    Examples

    The below examples shows, how to set the AllowExpandCollapse property of DataFormGroupItem 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; }
       public string Email { get; set; }
       public string MobileNumber { get; set; }
       public string Address { 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.GroupName = "ContactInfo";
       }
       if (e.DataFormGroupItem != null)
       {
          e.DataFormGroupItem.AllowExpandCollapse = false;
       }
    }
    this.dataForm.AutoGenerateItems = false;
    var items = new ObservableCollection<DataFormViewItem>();
    DataFormGroupItem dataFormGroupItem = new DataFormGroupItem();
    dataFormGroupItem.Name = "Contact Info";
    dataFormGroupItem.AllowExpandCollapse = false;
    dataFormGroupItem.Items = new ObservableCollection<DataFormItem>();
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName="Name" });
    dataFormGroupItem.Items.Add(new DataFormPasswordItem() { FieldName="Password"});
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName="Email" });
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName="Mobile Number"});
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName="Address"});
    this.dataForm.Items.Add(dataFormGroupItem);
    See Also
    Items
    Name
    IsExpanded

    ColumnCount

    Gets or sets the value representing the number of editors to be arranged per row in the DataFormGroupItem.

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

    The default value is 1.

    Examples

    The below examples shows, how to set the ColumnCount property of DataFormGroupItem 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; }
       public string Email { get; set; }
       public string MobileNumber { get; set; }
       public string Address { 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.GroupName = "ContactInfo";
       }
       if (e.DataFormGroupItem != null)
       {
          e.DataFormGroupItem.ColumnCount = 2;
       }
    }
    this.dataForm.AutoGenerateItems = false;
    var items = new ObservableCollection<DataFormViewItem>();
    DataFormGroupItem dataFormGroupItem = new DataFormGroupItem();
    dataFormGroupItem.Name = "Contact Info";
    dataFormGroupItem.ColumnCount = 2;
    dataFormGroupItem.Items = new ObservableCollection<DataFormItem>();
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName="Name" });
    dataFormGroupItem.Items.Add(new DataFormPasswordItem() { FieldName ="Password"});
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName = "Email" });
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName = "Mobile Number"});
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName = "Address"});
    this.dataForm.Items.Add(dataFormGroupItem);
    See Also
    Name
    Items
    AllowExpandCollapse

    HeaderBackground

    Gets or sets the background color for the header of the editor group.

    Declaration
    public Brush HeaderBackground { get; set; }
    Property Value
    Type Description
    Microsoft.Maui.Controls.Brush

    The default value is Microsoft.Maui.Graphics.Colors.LightGray.

    Remarks

    You can also use the HeaderTextStyle property to customize the group header text color, font, font size, font family and font attributes.

    Examples

    The below examples shows, how to set the HeaderBackground property of DataFormGroupItem 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; }
       public string Email { get; set; }
       public string MobileNumber { get; set; }
       public string Address { 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.GroupName = "ContactInfo";
       }
       if (e.DataFormGroupItem != null)
       {
          e.DataFormGroupItem.HeaderBackground =  Colors.LightGreen;
       }
    }
    this.dataForm.AutoGenerateItems = false;
    var items = new ObservableCollection<DataFormViewItem>();
    DataFormGroupItem dataFormGroupItem = new DataFormGroupItem();
    dataFormGroupItem.Name = "Contact Info";
    dataFormGroupItem.HeaderBackground = Colors.LightGreen;
    dataFormGroupItem.Items = new ObservableCollection<DataFormItem>();
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName="Name" });
    dataFormGroupItem.Items.Add(new DataFormPasswordItem() { FieldName="Password"});
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName="Email", RowOrder = 2 });
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName="Mobile Number"});
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName="Address"});
    this.dataForm.Items.Add(dataFormGroupItem);
    See Also
    Items
    Name
    HeaderTextStyle

    HeaderTextStyle

    Gets or sets the style of group header text, that used to customize the text color, font, font size, font family and font attributes.

    Declaration
    public DataFormTextStyle HeaderTextStyle { get; set; }
    Property Value
    Type Description
    DataFormTextStyle

    The default value of TextColor is Microsoft.Maui.Graphics.Colors.Black, FontSize is 16, FontFamily is null, FontAttributes is Microsoft.Maui.Controls.FontAttributes.Bold.

    Remarks

    You can also use the HeaderBackground property to customize the group header background.

    Examples

    The below examples shows, how to set the HeaderTextStyle property of DataFormGroupItem 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; }
       public string Email { get; set; }
       public string MobileNumber { get; set; }
       public string Address { 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.GroupName = "ContactInfo";
       }
       if (e.DataFormGroupItem != null)
       {
          e.DataFormGroupItem.HeaderTextStyle = new DataFormTextStyle()
          {
            TextColor = Colors.Orange,
            FontSize = 14,
          };
       }
    }
    var headerTextStyle = new DataFormTextStyle()
    {
      TextColor = Colors.Orange,
      FontSize = 14,
    };
    this.dataForm.AutoGenerateItems = false;
    var items = new ObservableCollection<DataFormViewItem>();
    DataFormGroupItem dataFormGroupItem = new DataFormGroupItem();
    dataFormGroupItem.Name = "Contact Info";
    dataFormGroupItem.HeaderTextStyle = headerTextStyle;
    dataFormGroupItem.Items = new ObservableCollection<DataFormItem>();
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName="Name" });
    dataFormGroupItem.Items.Add(new DataFormPasswordItem() { FieldName="Password"});
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName="Email"});
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName="Mobile Number"});
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName="Address"});
    this.dataForm.Items.Add(dataFormGroupItem);
    See Also
    Items
    Name
    HeaderBackground

    IsExpanded

    Gets or sets a value indicating whether the group of editors is expanded or not.

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

    The default value is true.

    Examples

    The below examples shows, how to set the IsExpanded property of DataFormGroupItem 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; }
       public string Email { get; set; }
       public string MobileNumber { get; set; }
       public string Address { 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.GroupName = "ContactInfo";
       }
       if (e.DataFormGroupItem != null)
       {
          e.DataFormGroupItem.IsExpanded = false;
       }
    }
    this.dataForm.AutoGenerateItems = false;
    var items = new ObservableCollection<DataFormViewItem>();
    DataFormGroupItem dataFormGroupItem = new DataFormGroupItem();
    dataFormGroupItem.Name = "Contact Info";
    dataFormGroupItem.IsExpanded = false;
    dataFormGroupItem.Items = new ObservableCollection<DataFormItem>();
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName="Name" });
    dataFormGroupItem.Items.Add(new DataFormPasswordItem() { FieldName="Password"});
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName="Email" });
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName="Mobile Number"});
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName="Address"});
    this.dataForm.Items.Add(dataFormGroupItem);
    See Also
    Name
    ColumnCount
    AllowExpandCollapse

    Items

    Gets or sets the value which used to set the items grouped under the group.

    Declaration
    public ObservableCollection<DataFormItem> Items { get; set; }
    Property Value
    Type Description
    System.Collections.ObjectModel.ObservableCollection<DataFormItem>
    Remarks

    This property is applicable to only when AutoGenerateItems is false.

    Examples

    The below examples shows, how to set the Items property of DataFormGroupItem in the SfDataForm.

    • XAML
    • C#
    <dataForm:SfDataForm x:Name="dataForm"
                         AutoGenerateItems="False">
      <dataForm:SfDataForm.Items>
         <dataForm:DataFormGroupItem Name="Contact Info">
             <dataForm:DataFormGroupItem.Items>
                 <dataForm:DataFormTextItem FieldName="Name" />
                 <dataForm:DataFormPasswordItem FieldName="Password" />
                 <dataForm:DataFormTextItem FieldName="Email" />
                 <dataForm:DataFormTextItem FieldName="Mobile Number" />
                 <dataForm:DataFormTextItem FieldName="Address" />
             </dataForm:DataFormGroupItem.Items>
         </dataForm:DataFormGroupItem>
      </dataForm:SfDataForm.Items>
    </dataForm:SfDataForm>
    this.dataForm.AutoGenerateItems = false;
    var items = new ObservableCollection<DataFormViewItem>();
    DataFormGroupItem dataFormGroupItem = new DataFormGroupItem();
    dataFormGroupItem.Name = "Contact Info";
    dataFormGroupItem.IsExpanded = true;
    dataFormGroupItem.Items = new ObservableCollection<DataFormItem>();
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName="Name" });
    dataFormGroupItem.Items.Add(new DataFormPasswordItem() { FieldName="Password"});
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName="Email" });
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName="Mobile Number"});
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName="Address"});
    this.dataForm.Items.Add(dataFormGroupItem);
    See Also
    Name
    ColumnCount
    AllowExpandCollapse

    ItemsPadding

    Gets or sets the distance between editors and the data form’s borders or group headers.

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

    The default value is 0.

    Examples

    The below examples shows, how to use the ItemsPadding of DataFormGroupItem 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; }
       public string Email { get; set; }
       public string MobileNumber { get; set; }
       public string Address { 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.GroupName = "ContactInfo";
       }
       if (e.DataFormGroupItem != null)
       {
          e.DataFormGroupItem.ItemsPadding = new Thickness(10);
       }
    }
    this.dataForm.AutoGenerateItems = false;
    var items = new ObservableCollection<DataFormViewItem>();
    DataFormGroupItem dataFormGroupItem = new DataFormGroupItem();
    dataFormGroupItem.Name = "Contact Info";
    dataFormGroupItem.ItemsPadding = new Thickness(10);
    dataFormGroupItem.Items = new ObservableCollection<DataFormItem>();
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName="Name" });
    dataFormGroupItem.Items.Add(new DataFormPasswordItem() { FieldName="Password"});
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName="Email", RowOrder = 2 });
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName="Mobile Number"});
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName="Address"});
    this.dataForm.Items.Add(dataFormGroupItem);
    See Also
    Items

    Name

    Gets or sets the name of the editor group.

    Declaration
    public string Name { get; set; }
    Property Value
    Type Description
    System.String
    Remarks

    This property is applicable to only when the AutoGenerateItems property is set to false.

    Examples

    The below examples shows, how to set the Name property of DataFormGroupItem 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; }
       public string Email { get; set; }
       public string MobileNumber { get; set; }
       public string Address { 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.GroupName = "ContactInfo";
       }
       if (e.DataFormGroupItem != null)
       {
          e.DataFormGroupItem.Name = "ContactInfo";
       }
    }
    this.dataForm.AutoGenerateItems = false;
    var items = new ObservableCollection<DataFormViewItem>();
    DataFormGroupItem dataFormGroupItem = new DataFormGroupItem();
    dataFormGroupItem.Name = "Contact Info";
    dataFormGroupItem.Items = new ObservableCollection<DataFormItem>();
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName="Name" });
    dataFormGroupItem.Items.Add(new DataFormPasswordItem() { FieldName="Password"});
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName="Email" });
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName="Mobile Number"});
    dataFormGroupItem.Items.Add(new DataFormTextItem() { FieldName="Address"});
    this.dataForm.Items.Add(dataFormGroupItem);
    See Also
    Items
    ColumnCount
    AllowExpandCollapse

    Methods

    OnBindingContextChanged()

    Invokes on the binding context of the view changed.

    Declaration
    protected override void OnBindingContextChanged()
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved