コード例 #1
0
        internal void SortColumn(GridPanel panel, GridColumn column)
        {
            if (panel.IsSortable == true)
            {
                if (column.IsGroupColumn == true)
                {
                    column.GroupDirection =
                        ToggleSortDirection(column.GroupDirection);
                }
                else if (column.ColumnSortMode != ColumnSortMode.None)
                {
                    SortDirection sortDirection =
                        ToggleSortDirection(column.SortDirection);

                    if (column.ColumnSortMode == ColumnSortMode.Multiple &&
                         ((Control.ModifierKeys & Keys.Shift) == Keys.Shift))
                    {
                        panel.AddSort(column, sortDirection);
                    }
                    else
                    {
                        if (panel.SortColumns.Count > 1)
                            sortDirection = SortDirection.Ascending;

                        panel.SetSort(column, sortDirection);
                    }

                    SuperGrid.DoSortChangedEvent(panel);
                }
                else
                {
                    InvalidateHeader(panel, column);
                }
            }
            else
            {
                InvalidateHeader(panel, column);
            }
        }