Skip to content

* September 2026 (Canary) - #616

Merged
PWagner1 merged 4 commits into
canaryfrom
alpha
Sep 21, 2026
Merged

PWagner1 merged 4 commits into
canaryfrom
alpha

Conversation

@PWagner1

Copy link
Copy Markdown
Contributor
  • September 2026 (Canary) - TBR: 21/09/2026

# AdvancedDataGridView Excel-style filter and sort headers

## Summary

`KryptonAdvancedDataGridView` already built BindingSource filter and sort strings, but the Excel-style header dropdowns from Davide Gironi’s AdvancedDataGridView never appeared. `KryptonDataGridView` paints themed headers and marks cell painting as handled, so the custom header cell never drew its filter button and clicks never hit it.

This change overlays Unicode filter/sort glyphs after the Krypton header is painted, hit-tests independently of `Paint`, and hosts the existing checklist, custom filter, and sort menu in themed Krypton controls. Consumers who bind a `BindingSource` and leave `FilterAndSortEnabled` at its default (`true`) now get visible, clickable header filters.

Glyphs: `▾` idle, `∇` filtered, `▲` / `▼` sorted, `∇▲` / `∇▼` filtered and sorted, `★` saved view.

## Related issues

Closes #443

Related: #512

## Type of change

Feature

## Changes

### `Krypton.Toolkit.Suite.Extended.AdvancedDataGridView`

- Overlay the filter button in `KryptonAdvancedDataGridView.OnCellPainting` after the themed header is drawn.
- Draw palette-aware button chrome and Unicode glyphs in `KryptonColumnHeaderCell` (`PaintFilterButton`).
- Compute filter-button bounds in mouse handlers so hover, press, and click work even when the cell `Paint` override is skipped.
- Scale the button with DPI; place it on the left in RTL; refresh layout on DPI and RTL changes.
- Skip the dropdown on image columns (same as before).
- Propagate `FilterAndSortEnabled` to existing columns when the grid property is toggled.
- Host the filter popup checklist, search box, and Filter/Cancel actions on `KryptonCheckedListBox`, `KryptonTextBox`, and `KryptonButton`.
- Module readme notes the glyphs and the `BindingSource` + `FilterAndSortEnabled` usage pattern.

### TestForm

- Keep the existing **Advanced Data Grid** demo (Gironi-style lab).
- Add **Advanced Data Grid (Filter & Sort)** (`AdvancedDataGridViewFilterSortExample`) for header glyphs, checklist, custom filter, saved views, search, RTL, per-column options, and live Filter/Sort strings.

### Docs

- Changelog entry under the in-progress 2611 section.

## Affected packages & target frameworks

- Package: `Krypton.Toolkit.Suite.Extended.AdvancedDataGridView`
- Module TFMs: `net472`, `net48`, `net481`, `net8.0-windows`, `net9.0-windows`, `net10.0-windows`, `net11.0-windows`
- Verified build: TestForm Debug `net8.0-windows`

## Validation

- TestForm demo: **Advanced Data Grid (Filter & Sort)** (`AdvancedDataGridViewFilterSortExample`). The original **Advanced Data Grid** form is unchanged as a regression lab.
- Manual steps:
  1. Run TestForm and optionally pick a theme on the Start Screen.
  2. Open **Advanced Data Grid (Filter & Sort)**.
  3. Confirm every non-image column shows a `▾` (or equivalent) header button.
  4. Open Category checklist, Product custom/text filter, and Price sort; confirm `∇` / `▲` / `▼` / combined glyphs and that Filter/Sort strings and row counts update. Confirm the popup checklist and Filter/Cancel buttons use the active Krypton theme.
  5. Save a view, clear, apply the saved view (`★`).
  6. Toggle Filter & sort enabled, RTL, and per-column options (Sku sort/checklist off, Updated date+time, Duration custom off, Flag no dropdown).
  7. Use the search toolbar and Product contains filter.
- Build command used: `dotnet build ".\Source\Krypton Toolkit\TestForm\TestForm.csproj" -c Debug -f net8.0-windows`
- Unit tests (if any): none for this module.

## Screenshots / GIFs

Attach when opening the PR (UI change):

- Idle headers with `▾` on a light and a dark/365 theme.
- Category checklist open from the header button.
- Filtered + sorted glyphs (`∇▲` / `∇▼`) and the live Filter/Sort strings.
- Image/Flag column with no dropdown.

Existing module GIF (pre-overlay, still useful for the popup menu):
https://github.com/Krypton-Suite/Documentation/blob/main/Assets/Extended-Toolkit/AdvancedDataGridView.gif

## Changelog

```
* Implemented [#443](#443), AdvancedDataGridView filter and sort header dropdowns
    - Excel-style filter buttons are drawn on Krypton column headers (`▾` idle, `∇` filtered, `▲`/`▼` sort, `★` saved)
    - Header overlay paints after `KryptonDataGridView` themed header rendering, with palette-aware colours, DPI scaling, and RTL placement
    - Filter popup uses `KryptonCheckedListBox`, `KryptonButton`, and `KryptonTextBox` so the checklist and Filter/Cancel actions follow the active theme
    - TestForm demo `AdvancedDataGridViewFilterSortExample` covers glyphs, checklist, custom filter, saved views, search, RTL, and per-column options
```

## Breaking changes & migration

None. Filter/sort APIs and BindingSource `Filter` / `Sort` behaviour are unchanged. Header buttons appear by default when `FilterAndSortEnabled` is `true` (already the default).

## Developer documentation

Local only (do not commit): `Documents/Development/Krypton-AdvancedDataGridView-Filter-Sort.md`.

Maintainer notes for reviewers:

- Root cause: `KryptonDataGridView.OnCellPainting` sets `e.Handled = true`, so `KryptonColumnHeaderCell.Paint` never ran and `_filterButtonImageBounds` stayed empty.
- Fix stays in Extended Toolkit: overlay after `base.OnCellPainting`, no Standard-Toolkit header fork.
- Header text can occupy the button corner; the overlay fills that region with the header back colour before drawing the glyph.
- `FilterAndSortEnabled` on the grid now calls `SetFilterAndSortEnabled` on existing columns; `PrepareFilterButtonLayout` keeps minimum column width and header height in step with DPI.
- Filter popup `MenuStrip` previously hosted WinForms `TreeView` / `Button` / `TextBox`. It now uses `KryptonCheckedListBox` (same `TreeNodeItemSelector` items, including flattened DateTime children), `KryptonButton`, and `KryptonTextBox`.
…ddatagridview---filter-sort

* AdvancedDataGridView Excel-style filter and sort headers
@PWagner1 PWagner1 added this to the Version 110 milestone Sep 16, 2026
@PWagner1
PWagner1 requested a review from a team September 16, 2026 11:14
@PWagner1 PWagner1 self-assigned this Sep 16, 2026
Upgrade the nightly Standard Toolkit package across projects and align System.Speech, System.Management, System.DirectoryServices, System.Drawing.Common, Microsoft.Web.WebView2, and System.Resources.Extensions dependencies with the latest RC package versions.
* Update nightly package dependencies
@PWagner1
PWagner1 merged commit e42b17a into canary Sep 21, 2026
0 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant