Skip to content

Fix ListView no longer displays images (servicing)#4222

Merged
RussKie merged 1 commit intodotnet:release/5.0from
RussKie:fix_4169
Nov 20, 2020
Merged

Fix ListView no longer displays images (servicing)#4222
RussKie merged 1 commit intodotnet:release/5.0from
RussKie:fix_4169

Conversation

@RussKie
Copy link
Contributor

@RussKie RussKie commented Nov 12, 2020

(cherry picked from commit d0608e7)

Fixes #4169

Proposed changes

Changes in ImageList ownership model in #3601 means that very are now two instances of imagelists - one instance is tracked by Windows Forms (i.e. managed) side, and another one tracked by the underlying Win32 (unmanaged) side. This was done due to an observed ownership disconnect between the managed and unmanaged code, that led to situations where the unmanaged code would effectively destroy and instance of an imagelist, which the managed code was oblivious to.

However with the above change changes to images in an imagelist on the managed side, i.e. a user adding or replacing an image in the imagelist, would not be reflected in the imagelist on the unmanaged side, and thus would not be reflected in the UI (which is drawn by the Win32).

The fix reuses the established infrastructure that notifies the managed imagelist implementation of changes to the images collection, and once a notification of a chance is received, the unmanaged imagelist is re-created, thus ensuring the UI has all the correct images to display.

Customer Impact

  • A control that references an ImageList that gets its images dynamically modified will render the images correctly.

Regression?

  • Yes

Risk

  • Minor
Microsoft Reviewers: Open in CodeFlow

@RussKie RussKie added 💥 regression-preview Regression from a preview release servicing-consider .NET Shiproom label indicating a PR seeks to enter into a branch under Tell-Mode criteria labels Nov 12, 2020
@RussKie RussKie added this to the 5.0.1 milestone Nov 12, 2020
@RussKie RussKie requested a review from a team as a code owner November 12, 2020 06:47
@ghost ghost assigned RussKie Nov 12, 2020
@RussKie RussKie linked an issue Nov 12, 2020 that may be closed by this pull request
@leecow leecow added servicing-approved .NET Shiproom approved the PR for merge and removed servicing-consider .NET Shiproom label indicating a PR seeks to enter into a branch under Tell-Mode criteria labels Nov 17, 2020
@RussKie RussKie merged commit bc41882 into dotnet:release/5.0 Nov 20, 2020
@RussKie RussKie deleted the fix_4169 branch November 20, 2020 10:15
@RussKie RussKie linked an issue Nov 25, 2020 that may be closed by this pull request
@ghost ghost locked as resolved and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

💥 regression-preview Regression from a preview release servicing-approved .NET Shiproom approved the PR for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ListView redraws when images are added to its ImageList net5.0 System.Windows.Forms.ListView no longer displays LargeIcon

3 participants