Class Group
Class that represents the group in SfDataGrid.
Implements
Inherited Members
Namespace: Syncfusion.UI.Xaml.Data
Assembly: Syncfusion.Data.WinUI.dll
Syntax
public class Group : GroupEntry, IDisposable, IEnumerable<NodeEntry>, IEnumerable
Constructors
Group(Group, Int32)
Initializes a new instance of the Group class.
Declaration
public Group(Group parent, int level)
Parameters
Type | Name | Description |
---|---|---|
Group | parent | The parent (group) of the new group being initialized. |
System.Int32 | level | The level of the newly initialized group. |
Fields
isDirty
Maintains a value that Indicates whether the group is dirty or not.
Declaration
protected bool isDirty
Field Value
Type |
---|
System.Boolean |
isSourceYAmountDirty
Maintains a value Indicates whether the Y amount cache is dirty or not.
Declaration
protected bool isSourceYAmountDirty
Field Value
Type |
---|
System.Boolean |
TopLevelGroup
Maintains a new Instance of TopLevelGroup
Declaration
protected TopLevelGroup TopLevelGroup
Field Value
Type |
---|
TopLevelGroup |
Properties
Details
Gets or protectedly sets the details of the group which can be either sub-groups or records collection of the group.
Declaration
public NodeEntry Details { get; protected set; }
Property Value
Type | Description |
---|---|
NodeEntry | The details of the group which can be either sub-groups or records collection of the group. |
Groups
Gets the list of groups in the group, if the Details is the list of groups.
Declaration
public List<Group> Groups { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<Group> | The list of groups in the group, if the Details is the list of groups. |
IsBottomLevel
Gets or protectedly sets a value indicating whether the current group is bottom-level group. Bottom-level group contains the list of records for the group.
Declaration
public bool IsBottomLevel { get; protected set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if the current instance is bottom-level group, otherwise false. |
IsExpanded
Gets or sets a boolean value indicating whether the current group is expanded.
Declaration
public bool IsExpanded { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | True if the current group is expanded, otherwise false. |
IsTopLevelGroup
Gets a value indicating whether the current group is the top-level group. Top-level group will be the first-level group. All groups will have the root group which is the top-level group.
Declaration
public virtual bool IsTopLevelGroup { get; }
Property Value
Type | Description |
---|---|
System.Boolean | True if the current group is the top level group, otherwise false. |
ItemsCount
Gets the number of records in the group, if the current group is the bottom-level group. and number of groups in the group, if the current group is not the bottom-level group.
Declaration
public virtual int ItemsCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of records in the group. |
Key
Gets or sets the key of the group. Each group will have the key, the groups can be accessed easily by its key.
Declaration
public object Key { get; set; }
Property Value
Type | Description |
---|---|
System.Object | The key of the group. |
Parent
Gets the parent (group) of the current group.
Declaration
public Group Parent { get; set; }
Property Value
Type | Description |
---|---|
Group | The parent group of the current group. |
Records
Gets the records of the group, if the Details is the list of records.
Declaration
public IRecordsEntryList Records { get; }
Property Value
Type | Description |
---|---|
IRecordsEntryList | The records of the group, if the Details is the list of records. |
Source
Gets the source of the group which contains the list of all the items in the group.
Declaration
public List<object> Source { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<System.Object> | The source of the group which contains the list of all the items in the group. |
SummaryDetails
Gets or sets the summary details of the group.
Declaration
public SummaryRecordEntry SummaryDetails { get; set; }
Property Value
Type | Description |
---|---|
SummaryRecordEntry | The summary details of the group. |
Methods
AddItem(Object)
Adds the given record to the source of the group. The item added to the source of the group will not be added in the view of the group. If the user needs to add the item to the view and to the underlying collection of the group, he can achieve his requirement by using AddRecord(RecordEntry, Boolean).
Declaration
public virtual void AddItem(object record)
Parameters
Type | Name | Description |
---|---|---|
System.Object | record | The record to be added to the group. |
AddRecord(RecordEntry, Boolean)
Adds the given record to the group.
Declaration
public virtual void AddRecord(RecordEntry record, bool isInSourceCollectionChange)
Parameters
Type | Name | Description |
---|---|---|
RecordEntry | record | The record to be added to the group. |
System.Boolean | isInSourceCollectionChange | A boolean value indicating whether the source collection change is currently in progress. |
CreateDetailsForGroups(Int32)
Creates details for the groups at the given level.
Declaration
public virtual void CreateDetailsForGroups(int level)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | level | The level of the group for which details is to be added. |
CreateDetailsForRecords(Group, IEnumerable, Int32)
Creates the details for the records in the group at the given level in the given parent group.
Declaration
public virtual void CreateDetailsForRecords(Group parent, IEnumerable source, int level)
Parameters
Type | Name | Description |
---|---|---|
Group | parent | The parent group of the records, which is the bottom-level group. |
System.Collections.IEnumerable | source | The enumerable collection of source which contains the info of the details for records. |
System.Int32 | level | The level of the group for which the details is to be created. |
CreateDetailsForRecords(Group, Int32)
Creates the details for the records in the group at the given level in the given parent group.
Declaration
public virtual void CreateDetailsForRecords(Group parent, int level)
Parameters
Type | Name | Description |
---|---|---|
Group | parent | The parent group of the records, which is the bottom-level group. |
System.Int32 | level | The level of the group for which the details is to be created. |
CreateNewGroup(Group, GroupResult, Int32)
Creates the new group based on the given credentials.
Declaration
protected virtual Group CreateNewGroup(Group parent, GroupResult groupResult, int level)
Parameters
Type | Name | Description |
---|---|---|
Group | parent | The parent (group) of the newly created group. |
GroupResult | groupResult | The group result which contains the information of the groups. |
System.Int32 | level | The level at which the group is to be added. |
Returns
Type | Description |
---|---|
Group | Returns the newly created group. |
CreateNewGroup(Group, Object, Int32)
Creates the new group within the given parent group, with the given key and level.
Declaration
public virtual Group CreateNewGroup(Group parent, object key, int level)
Parameters
Type | Name | Description |
---|---|---|
Group | parent | The group which is to be the parent of the new group. |
System.Object | key | The key of the group to be added. |
System.Int32 | level | The level in which the group is to be added. |
Returns
Type | Description |
---|---|
Group | Returns the newly created group. |
Dispose(Boolean)
Releases the unmanaged resources and optionally releases the managed resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | A boolean value indicating whether to release both managed and unmanaged resources. True to release both managed and unmanaged resources; false to release only unmanaged resources. |
Overrides
GetEnumerator()
Returns an enumerator that iterates through the collection of items in the group.
Declaration
public IEnumerator<NodeEntry> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<NodeEntry> | A System.Collections.Generic.IEnumerator<> that can be used to iterate through the collection of items in the group. |
GetGroupsCount()
Gets the number of groups in the group, if it contains sub-groups.
Declaration
public virtual int GetGroupsCount()
Returns
Type | Description |
---|---|
System.Int32 | The number of groups in the group, if it contains sub-groups. |
GetParentYAmountCache()
Gets the Y amount cache of the parent, which contains the sum of the y height of each sub-groups (if any) based on its inner node levels and their expanded states.
Declaration
public int GetParentYAmountCache()
Returns
Type | Description |
---|---|
System.Int32 | The Y amount cache of the parent, which contains the sum of the y height of each sub-groups (if any) based on its inner node levels and their expanded states. |
GetRecordAt(Int32)
Gets the record at the given index in the group.
Declaration
public virtual RecordEntry GetRecordAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index at which the record is to be obtained. |
Returns
Type | Description |
---|---|
RecordEntry | The record at the given index in the group. |
GetRecordCount()
Gets the number of records in the group, which contains the items in the group which are in view.
Declaration
public virtual int GetRecordCount()
Returns
Type | Description |
---|---|
System.Int32 | The number of records in the group, which contains the items in the group which are in view. |
GetRecordIndex(RecordEntry)
Gets the record index for the given record in the group.
Declaration
public virtual int GetRecordIndex(RecordEntry record)
Parameters
Type | Name | Description |
---|---|---|
RecordEntry | record | The record for which the index is to be obtained. |
Returns
Type | Description |
---|---|
System.Int32 | The record index for the given record in the group. |
GetRecordIndex(Object)
Gets the record index for the given record in the group.
Declaration
public virtual int GetRecordIndex(object item)
Parameters
Type | Name | Description |
---|---|---|
System.Object | item | The record for which the index is to be obtained. |
Returns
Type | Description |
---|---|
System.Int32 | The record index for the given record in the group. |
GetRelationsCount()
Gets the relations count of the group, that link grid and allow navigation from parent grid to child grid.
Declaration
public int GetRelationsCount()
Returns
Type | Description |
---|---|
System.Int32 | The relations count of the group, that link grid and allow navigation from parent grid to child grid. |
GetSourceCount()
Gets the count of the items in the group, which contains all the items in the group.
Declaration
public virtual int GetSourceCount()
Returns
Type | Description |
---|---|
System.Int32 | The count of the items in the group, which contains all the items in the group. |
GetSourceYAmountCache()
Gets the Y amount cache of the group. Each group knows the exact height of its child nodes. The YAmountCache returns the y height of each group based on its inner node levels and their expanded states.
Declaration
public virtual int GetSourceYAmountCache()
Returns
Type | Description |
---|---|
System.Int32 | The Y amount cache which contains the y height of each group based on its inner node levels and their expanded states. |
GetSummaryValue(String)
Gets the summary value for the given column name.
Declaration
public string GetSummaryValue(string columnName)
Parameters
Type | Name | Description |
---|---|---|
System.String | columnName | The column name for which the summary value is to be obtained. |
Returns
Type | Description |
---|---|
System.String | The summary value for the given column name. |
GetSummaryValue(String, String)
Gets the summary value for the given column name and its aggregate type.
Declaration
public object GetSummaryValue(string columnName, string aggregateKey)
Parameters
Type | Name | Description |
---|---|---|
System.String | columnName | The column name for which the summary value is to be obtained. |
System.String | aggregateKey | The aggregate type of the column which is grouped. |
Returns
Type | Description |
---|---|
System.Object | The summary value for the given column name and its aggregate type. |
GetYAmountCache()
Gets the Y amount cache of the group. Each group knows the exact height of its child nodes. The YAmountCache returns the y height of each group based on its inner node levels and their expanded states.
Declaration
public virtual int GetYAmountCache()
Returns
Type | Description |
---|---|
System.Int32 | The Y amount cache which contains the y height of each group based on its inner node levels and their expanded states. |
InsertRecord(Int32, RecordEntry, Boolean)
Inserts the given record at the given index in the group.
Declaration
public virtual void InsertRecord(int index, RecordEntry record, bool isInSourceCollectionChange)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index at which the given record is to be inserted. |
RecordEntry | record | The record to be inserted. |
System.Boolean | isInSourceCollectionChange | A boolean value indicating whether the source collection change is currently in progress. |
OnGroupCollapsed()
This method fires when the current group is collapsed.
Declaration
protected virtual void OnGroupCollapsed()
OnGroupExpanded()
This method fires when the current group is expanded.
Declaration
protected virtual void OnGroupExpanded()
Populate(IEnumerable<GroupResult>)
Populates the given groups to the current group in the data grid.
Declaration
public virtual int Populate(IEnumerable<GroupResult> groupsToPopulate)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<GroupResult> | groupsToPopulate | The enumerable collection of groups to be populated. |
Returns
Type | Description |
---|---|
System.Int32 | Returns the total number of entries in top-Level group, which contains the sum of the number of records in each group added. |
Populate(IEnumerable<GroupResult>, List<Group>, Group, Int32)
Populates the given groups to the current group in the data grid.
Declaration
protected virtual int Populate(IEnumerable<GroupResult> groupsToPopulate, List<Group> groups, Group parent, int level)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<GroupResult> | groupsToPopulate | The enumerable collection of groups to be populated. |
System.Collections.Generic.List<Group> | groups | The list of groups in the current group. |
Group | parent | The parent (group) of the group to be added. |
System.Int32 | level | The level of the group to be added. |
Returns
Type | Description |
---|---|
System.Int32 | Returns the total number of entries in top-Level group, which contains the sum of the number of records in each group added. |
RecalculateSourceYAmount()
Recalculates the Y amount cache of the group. Each group knows the exact height of its child nodes. The Y amount cache returns the y height of each group based on its inner node levels and their expanded states.
Declaration
protected void RecalculateSourceYAmount()
RecalculateYAmount()
Recalculates the Y amount cache of the group. Each group knows the exact height of its child nodes. The Y amount cache returns the y height of each group based on its inner node levels and their expanded states.
Declaration
protected void RecalculateYAmount()
RemoveItem(Object)
Removes the given record from the source of the group. If the item is not in the view, but it is contained in the collection of the source of the group, it can be removed by this method.
Declaration
public virtual bool RemoveItem(object record)
Parameters
Type | Name | Description |
---|---|---|
System.Object | record | The record to be removed. |
Returns
Type | Description |
---|---|
System.Boolean | A boolean value indicating whether the given record is removed. |
RemoveRecord(RecordEntry, Boolean)
Removes the given record from the group.
Declaration
public virtual bool RemoveRecord(RecordEntry record, bool isInSourceCollectionChange)
Parameters
Type | Name | Description |
---|---|---|
RecordEntry | record | The record to be removed. |
System.Boolean | isInSourceCollectionChange | A boolean value indicating whether the source collection change is currently in progress. |
Returns
Type | Description |
---|---|
System.Boolean | A boolean value indicating whether the given record is removed. |
ResetSourceYAmount()
Resets the Y amount cache of the group.
Declaration
protected void ResetSourceYAmount()
ResetYAmount()
Resets the Y amount cache of the group.
Declaration
protected void ResetYAmount()
SetDirty()
Sets the group as dirty. When this is set to true, the YAmountCache will be re-computed for the whole group structure. By calling this method, the height of the top-level group will be computed.
Declaration
public void SetDirty()
Events
PropertyChanged
Occurs when the property of the group is changed.
Declaration
public event EventHandler<PropertyChangedEventArgs> PropertyChanged
Event Type
Type |
---|
System.EventHandler<System.ComponentModel.PropertyChangedEventArgs> |