Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions WindowsForms/GridGrouping/Advanced-Features.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Custom Grouping can be achieved by adding a custom Categorizer object to SortCol

Say you have a column with values for 0 to 50, and you want to have them grouped so that values less than 10 are in one group, values 10-20 are in another, values 20-30 in another, and so on. The following code example illustrates how to achieve this by using Custom Categorizer.

1. Create a datasource and bind it to a grid grouping control.
1. Create a datasource and bind it to a GridGroupingControl.
{% capture codesnippet1 %}
{% tabs %}
{% highlight C# %}
Expand Down Expand Up @@ -350,15 +350,15 @@ Given below is a sample screen shot.

## Custom Sorting

Custom Sorting allows you to implement custom sorting logic when the standard sorting techniques do not meet your needs. To support custom sorting in Grid Grouping control, the user needs to add an IComparer object and handle one event. The Comparer object allows you to control how the sorting is done on the column. This is the place where you can define your own sorting logic. After customizing the sorting logic through IComparer, you can make grouping grid use this special IComparer by handling an event.
Custom Sorting allows you to implement custom sorting logic when the standard sorting techniques do not meet your needs. To support custom sorting in GridGroupingControl, the user needs to add an IComparer object and handle one event. The Comparer object allows you to control how the sorting is done on the column. This is the place where you can define your own sorting logic. After customizing the sorting logic through IComparer, you can make grouping grid use this special IComparer by handling an event.

### Example

Consider a scenario where one of the data columns of your datasource consists of Date-Numeric combination values. In this case, default sorting will not produce results we desire. The sorting has to be done first on date values and then on numeric values. Hence, we need to write custom sorting logic by defining special IComparer object. The grouping grid could then be made to use this custom comparer by handling an event that gets fired while sorting columns.

The example illustrates this process in a step-by-step manner.

1. Setup a datasource and bind it to a grid grouping control.
1. Setup a datasource and bind it to a GridGroupingControl.
{% capture codesnippet5 %}
{% tabs %}
{% highlight C# %}
Expand Down Expand Up @@ -519,10 +519,10 @@ private string specialDateColName = "Col3";

private DateComparer specialDateComparer = new DateComparer();

//Sets up support for custom sort on Grid Grouping control.
//Sets up support for custom sort on GridGroupingControl.
this.gridGroupingControl1.TableDescriptor.SortedColumns.Changing += new ListPropertyChangedEventHandler(SortedColumns_Changing);

//Makes the Grid Grouping control use special IComparer.
//Makes the GridGroupingControl use special IComparer.
void SortedColumns_Changing(object sender, ListPropertyChangedEventArgs e)
{
SortColumnDescriptor sortColumnDescriptor = e.Item as SortColumnDescriptor;
Expand All @@ -539,10 +539,10 @@ Private specialDateColName As String = "Col3"

Private specialDateComparer As DateComparer = New DateComparer()

'Sets up support for custom sort on Grid Grouping control.
'Sets up support for custom sort on GridGroupingControl.
AddHandler gridGroupingControl1.TableDescriptor.SortedColumns.Changing, AddressOf SortedColumns_Changing

'Makes the Grid Grouping control use special IComparer.
'Makes the GridGroupingControl use special IComparer.

Private Sub SortedColumns_Changing(ByVal sender As Object, ByVal e As ListPropertyChangedEventArgs)
Dim sortColumnDescriptor As SortColumnDescriptor = CType(IIf(TypeOf e.Item Is SortColumnDescriptor, e.Item, Nothing), SortColumnDescriptor)
Expand Down
4 changes: 2 additions & 2 deletions WindowsForms/GridGrouping/Data-Binding.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ The Grid will be populated as follows,
<Installed_Location>\Syncfusion\EssentialStudio[Version_Number]\Windows\Grid.Grouping.Windows\Samples\Data Sources\Array List Demo

### Binding IBindingList Collection
This section demonstrates implementation of `IBindingList` and how to bind this list to GridGrouping control. As `IBindingList` derives from `IList`, it requires the implementation of all the members of the `IList`, `ICollection` and `IEnumerable` interfaces.
This section demonstrates implementation of `IBindingList` and how to bind this list to GridGroupingControl. As `IBindingList` derives from `IList`, it requires the implementation of all the members of the `IList`, `ICollection` and `IEnumerable` interfaces.

#### Benefits
The benefit of using `IBindingList` includes support for change notifications when the list is modified. It does have `ListChanged` event, which will be fired upon any data change. If the collection supports changes, it should also support firing `ListChanged` event when the collection changes. To indicate that, the collection should return true from `SupportsChangeNotification` property. Hence when items are added or removed from the collection, the grouping grid will be notified of these changes and will update itself automatically.
Expand Down Expand Up @@ -512,7 +512,7 @@ Since the collection knows the type of object, it does not need to type cast ite
While writing the code to manage collection items, user can perform any other operation on the items that are being written into and read from the collection.

### Collection Base
Strongly Typed collection can be created by inheriting from the `System.Collections.CollectionBase` class. `CollectionBase` class implements IList, IListSource, and IEnumerable. These interfaces enable the users to implement methods and properties that support binding, enumerating, and looping using ForEach construct. The result is that your strongly typed collections can be bound directly to our grid grouping control as data source.
Strongly Typed collection can be created by inheriting from the `System.Collections.CollectionBase` class. `CollectionBase` class implements IList, IListSource, and IEnumerable. These interfaces enable the users to implement methods and properties that support binding, enumerating, and looping using ForEach construct. The result is that your strongly typed collections can be bound directly to our GridGroupingControl as data source.

1. Create a class Product whose instances represent the records and properties represent the record fields.

Expand Down
Loading