Skip to content

Fix ListView destroying StateImageList when toggling CheckBoxes#14652

Open
KSaiSivani wants to merge 1 commit into
dotnet:mainfrom
KSaiSivani:Fix_Issue_3531
Open

Fix ListView destroying StateImageList when toggling CheckBoxes#14652
KSaiSivani wants to merge 1 commit into
dotnet:mainfrom
KSaiSivani:Fix_Issue_3531

Conversation

@KSaiSivani

@KSaiSivani KSaiSivani commented Jun 16, 2026

Copy link
Copy Markdown

Fixes #3531

Proposed changes

  • Update ListView.CheckBoxes setter to call RecreateHandleInternal() when toggling from true → false as well as false → true.

  • Ensure LVM_SETIMAGELIST is resent after handle recreation so the user‑supplied StateImageList is preserved.

  • Prevent native ListView from discarding or corrupting the StateImageList when checkboxes are toggled.

Customer Impact

  • Fixes scenarios where toggling CheckBoxes caused custom state images to disappear or the ImageList to be disposed.

  • Ensures developers can reliably use StateImageList with checkboxes without losing images.

  • Improves stability in apps that dynamically toggle CheckBoxes at runtime.

Regression?

  • No

Risk

  • Low. The change is isolated to the CheckBoxes setter and handle recreation path.

Screenshots

Before

ListView_CheckBoxes_false_without_fix.mp4
ListView_CheckBoxes_true_without_fix.mp4

After

ListView_CheckBoxes_false_with_fix.mp4
ListView_CheckBoxes_true_with_fix.mp4

Test methodology

  • Manually toggled CheckBoxes across multiple views (List, SmallIcon, LargeIcon) with custom state images.

  • Verified items with StateImageIndex retained correct images after toggling.

  • Validated under high DPI scaling to confirm images remained intact.

  • Repeated toggle operations to confirm stability across multiple transitions.

Test environment(s)

  • 11.0.100-preview.3.26170.106
Microsoft Reviewers: Open in CodeFlow

@KSaiSivani KSaiSivani requested a review from a team as a code owner June 16, 2026 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Setting ListView.CheckBoxes after ListView.StateImageList destroys imagelist

1 participant