Example #1
0
        /// <summary>
        /// Sort columns
        /// </summary>
        private void DataGridFavorites_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            var lastSortedColumn = this.dataGridFavorites.FindLastSortedColumn();
            var column           = this.dataGridFavorites.Columns[e.ColumnIndex];

            var newSortDirection = SortableUnboundGrid.GetNewSortDirection(lastSortedColumn, column);
            var data             = (SortableList <FavoriteViewModel>) this.bsFavorites.DataSource;

            this.bsFavorites.DataSource          = data.SortByProperty(column.DataPropertyName, newSortDirection);
            column.HeaderCell.SortGlyphDirection = newSortDirection;
        }
Example #2
0
        private void GridScanResults_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            var lastSortedColumn = this.gridScanResults.FindLastSortedColumn();
            var column           = this.gridScanResults.Columns[e.ColumnIndex];

            var newSortDirection = SortableUnboundGrid.GetNewSortDirection(lastSortedColumn, column);
            var data             = this.bsScanResults.DataSource as SortableList <NetworkScanResult>;

            this.bsScanResults.DataSource        = data.SortByProperty(column.DataPropertyName, newSortDirection);
            column.HeaderCell.SortGlyphDirection = newSortDirection;
        }