// Sorts the grid // Can't use SortCompare method because this grid is data-bound private void dataGridViewCapValues_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { if (dataGridViewCapValues.DataSource != null && iframes != null && listBindingCap != null) { DataGridViewColumn selectedColumn = dataGridViewCapValues.Columns[e.ColumnIndex]; var iframeCaptureComparer = new IFrameCaptureComparer { CompareType = selectedColumn.DataPropertyName }; if (selectedColumn.HeaderCell.SortGlyphDirection == SortOrder.Ascending) { iframeCaptureComparer.sortOrder = SortOrder.Descending; } iframes.Sort(iframeCaptureComparer); listBindingCap.ResetBindings(false); selectedColumn.HeaderCell.SortGlyphDirection = iframeCaptureComparer.sortOrder; } }
private void ResortGrid(BindingSource bindingSource, DoubleBufferedDataGridView dataGrid, FrameType frameType) { switch (frameType) { case FrameType.Method5Standard: case FrameType.Method5Natures: case FrameType.Wondercard5thGen: case FrameType.Wondercard5thGenFixed: var iframeCaptureComparer = new IFrameCaptureComparer {CompareType = "TimeDate"}; ((List<IFrameCapture>) bindingSource.DataSource).Sort(iframeCaptureComparer); CapDateTime.HeaderCell.SortGlyphDirection = SortOrder.Ascending; break; case FrameType.BWBred: case FrameType.BWBredInternational: iframeCaptureComparer = new IFrameCaptureComparer {CompareType = "TimeDate"}; ((List<IFrameCapture>) bindingSource.DataSource).Sort(iframeCaptureComparer); ColumnEggDate.HeaderCell.SortGlyphDirection = SortOrder.Ascending; break; } dataGrid.DataSource = bindingSource; bindingSource.ResetBindings(false); }
// Sorts the grid // Can't use SortCompare method because this grid is data-bound private void dataGridViewCapValues_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { if (dataGridViewCapValues.DataSource != null && iframes != null && listBindingCap != null) { DataGridViewColumn selectedColumn = dataGridViewCapValues.Columns[e.ColumnIndex]; var iframeCaptureComparer = new IFrameCaptureComparer {CompareType = selectedColumn.DataPropertyName}; if (selectedColumn.HeaderCell.SortGlyphDirection == SortOrder.Ascending) iframeCaptureComparer.sortOrder = SortOrder.Descending; iframes.Sort(iframeCaptureComparer); listBindingCap.ResetBindings(false); selectedColumn.HeaderCell.SortGlyphDirection = iframeCaptureComparer.sortOrder; } }
private void ResortGrid(BindingSource bindingSource, DoubleBufferedDataGridView dataGrid, FrameType frameType) { switch (frameType) { case FrameType.MethodJ: case FrameType.MethodK: var iframeCaptureComparer = new IFrameCaptureComparer {CompareType = "Seed"}; ((List<IFrameCapture>) bindingSource.DataSource).Sort(iframeCaptureComparer); CapSeed.HeaderCell.SortGlyphDirection = SortOrder.Ascending; break; } dataGrid.DataSource = bindingSource; bindingSource.ResetBindings(false); }