Class DataFormGroupItem
Represents the class to encapsulates the group settings for group of data field's appearing in DataForm.
Inheritance
System.Object
DataFormGroupItem
Assembly: Syncfusion.Maui.DataForm.dll
public class DataFormGroupItem : DataFormViewItem, IThemeElement
Constructors
Declaration
public DataFormGroupItem()
Fields
Declaration
public static readonly BindableProperty AllowExpandCollapseProperty
Field Value
Type |
Description |
Microsoft.Maui.Controls.BindableProperty |
The identifier for AllowExpandCollapse dependency property.
|
Declaration
public static readonly BindableProperty ColumnCountProperty
Field Value
Type |
Description |
Microsoft.Maui.Controls.BindableProperty |
The identifier for ColumnCount dependency property.
|
Declaration
public static readonly BindableProperty HeaderBackgroundProperty
Field Value
Type |
Description |
Microsoft.Maui.Controls.BindableProperty |
The identifier for HeaderBackground dependency property.
|
Declaration
public static readonly BindableProperty HeaderTextStyleProperty
Field Value
Type |
Description |
Microsoft.Maui.Controls.BindableProperty |
The identifier for HeaderTextStyle dependency property.
|
Declaration
public static readonly BindableProperty IsExpandedProperty
Field Value
Type |
Description |
Microsoft.Maui.Controls.BindableProperty |
The identifier for IsExpanded dependency property.
|
Declaration
public static readonly BindableProperty ItemsPaddingProperty
Field Value
Type |
Description |
Microsoft.Maui.Controls.BindableProperty |
The identifier for ItemsPadding dependency property.
|
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.
|
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
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 .
|
The below examples shows, how to set the AllowExpandCollapse property of DataFormGroupItem in the SfDataForm.
<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);
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 .
|
The below examples shows, how to set the ColumnCount property of DataFormGroupItem in the SfDataForm.
<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);
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.
|
The below examples shows, how to set the HeaderBackground property of DataFormGroupItem in the SfDataForm.
<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);
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
The below examples shows, how to set the HeaderTextStyle property of DataFormGroupItem in the SfDataForm.
<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);
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 .
|
The below examples shows, how to set the IsExpanded property of DataFormGroupItem in the SfDataForm.
<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);
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 |
System.Collections.ObjectModel.ObservableCollection<DataFormItem> |
The below examples shows, how to set the Items property of DataFormGroupItem in the SfDataForm.
<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);
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 .
|
The below examples shows, how to use the ItemsPadding of DataFormGroupItem in the SfDataForm.
<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);
Gets or sets the name of the editor group.
Declaration
public string Name { get; set; }
Property Value
The below examples shows, how to set the Name property of DataFormGroupItem in the SfDataForm.
<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);
Methods
OnBindingContextChanged()
Invokes on the binding context of the view changed.
Declaration
protected override void OnBindingContextChanged()