BrightIdeasSoftware.ObjectListView.BuildGroups C# (CSharp) Method

BuildGroups() public method

Organise the view items into groups, based on the given columns
This method does not trigger sorting events. Use BuildGroups() to do that
public BuildGroups ( OLVColumn groupByColumn, SortOrder groupByOrder, OLVColumn column, SortOrder order, OLVColumn secondaryColumn, SortOrder secondaryOrder ) : void
groupByColumn OLVColumn What column will be used for grouping
groupByOrder SortOrder What ordering will be used for groups
column OLVColumn The column whose values should be used for sorting. Cannot be null
order SortOrder The order in which the values from column will be sorted
secondaryColumn OLVColumn When the values from 'column' are equal, use the values provided by this column
secondaryOrder SortOrder How will the secondary values be sorted
return void
        public virtual void BuildGroups(OLVColumn groupByColumn, SortOrder groupByOrder,
            OLVColumn column, SortOrder order, OLVColumn secondaryColumn, SortOrder secondaryOrder)
        {
            // Sanity checks
            if (groupByColumn == null)
                return;

            // Getting the Count forces any internal cache of the ListView to be flushed. Without
            // this, iterating over the Items will not work correctly if the ListView handle
            // has not yet been created.
            #pragma warning disable 168
            int dummy = this.Items.Count;
            #pragma warning restore 168

            // Collect all the information that governs the creation of groups
            GroupingParameters parms = this.CollectGroupingParameters(groupByColumn, groupByOrder,
                column, order, secondaryColumn, secondaryOrder);

            // Trigger an event to let the world create groups if they want
            CreateGroupsEventArgs args = new CreateGroupsEventArgs(parms);
            if (parms.GroupByColumn != null)
                args.Canceled = !parms.GroupByColumn.Groupable;
            this.OnBeforeCreatingGroups(args);
            if (args.Canceled)
                return;

            // If the event didn't create them for us, use our default strategy
            if (args.Groups == null)
                args.Groups = this.MakeGroups(parms);

            // Give the world a chance to munge the groups before they are created
            this.OnAboutToCreateGroups(args);
            if (args.Canceled)
                return;

            // Create the groups now
            this.OLVGroups = args.Groups;
            this.CreateGroups(args.Groups);

            // Tell the world that new groups have been created
            this.OnAfterCreatingGroups(args);
        }

Same methods

ObjectListView::BuildGroups ( ) : void
ObjectListView::BuildGroups ( OLVColumn column, SortOrder order ) : void
ObjectListView