maui icon indicating copy to clipboard operation
maui copied to clipboard

Fixed CollectionView.EmptyView can not be removed by setting it to Null

Open Dhivya-SF4094 opened this issue 6 months ago • 8 comments
trafficstars

[!NOTE] Are you waiting for the changes in this PR to be merged? It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Issue Details

In WinUI, setting the CollectionView's EmptyView to null does not fully remove the associated visual element. While the reference is cleared, the view remains in the visual tree and memory, leading to an inconsistent UI state.

Root Cause

When EmptyView was set to null, the handler exited early without performing the necessary cleanup. As a result, the visual element persisted in the UI tree and memory.

Description of Change

The logic now explicitly collapses the EmptyView's visibility when applicable and removes it from the logical tree to ensure it is detached from the visual hierarchy. Internal references are cleared, and the display flag is reset to maintain an accurate UI state.

#29463 - Issue 1: EmptyView Template is Not Displayed

Root Cause

The EmptyViewTemplate was not considered in the UpdateEmptyView, causing it to be ignored.

Description of Change

The EmptyViewTemplate is now properly managed to ensure it appears when appropriate.

Validated the behaviour in the following platforms

  • [x] Android
  • [x] Windows
  • [x] iOS
  • [X] Mac

Issues Fixed:

Fixes #18657 Fixes #29463

Screenshots

Before After
    

Dhivya-SF4094 avatar May 14 '25 06:05 Dhivya-SF4094

/azp run MAUI-UITests-public

jsuarezruiz avatar May 16 '25 11:05 jsuarezruiz

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar May 16 '25 11:05 azure-pipelines[bot]

/azp run MAUI-UITests-public

jsuarezruiz avatar May 19 '25 06:05 jsuarezruiz

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar May 19 '25 06:05 azure-pipelines[bot]

These tests: image

Seems to be crashing on Windows. The app was expected to be running still, investigate as possible crash

Could you review if are related with the changes?

@jsuarezruiz Currently looking into the CI test failure on Windows.

Dhivya-SF4094 avatar May 20 '25 11:05 Dhivya-SF4094

These tests: image

Seems to be crashing on Windows. The app was expected to be running still, investigate as possible crash

Could you review if are related with the changes?

@jsuarezruiz Fixed CI failure. Could you please review it once.

Dhivya-SF4094 avatar May 22 '25 11:05 Dhivya-SF4094

/azp run MAUI-UITests-public

jsuarezruiz avatar May 26 '25 07:05 jsuarezruiz

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar May 26 '25 07:05 azure-pipelines[bot]