Skip to content

fix: Apply ItemContainerStyle to realized containers when it changes (fixes #26423) - #26689

Open
seragAhmed wants to merge 1 commit into
unoplatform:masterfrom
seragAhmed:fix/26423-itemcontainerstyle-refresh
Open

seragAhmed wants to merge 1 commit into
unoplatform:masterfrom
seragAhmed:fix/26423-itemcontainerstyle-refresh

Conversation

@seragAhmed

Copy link
Copy Markdown
Contributor

GitHub Issue: closes #26423

PR Type:

🐞 Bugfix

What changed? 🚀

Setting ItemsControl.ItemContainerStyle (or ItemContainerStyleSelector) after the containers were realized didn't apply the new style to them.

  • OnItemContainerStyleChanged / OnItemContainerStyleSelectorChanged only called Refresh(), which is empty outside the Selector family, and ApplyItemContainerStyle only ran when a container was prepared.
  • Both handlers now re-apply the style to the realized containers (items panel children with a valid index), like WinUI's RefreshContainers.
  • Like WinUI, a selector change doesn't touch the containers while ItemContainerStyle is set.

Validation

  • Runtime tests Given_ItemsControl.When_ItemContainerStyle_Set_After_Containers_Realized (also checks that clearing the style restores the default) and When_ItemContainerStyleSelector_Set_After_Containers_Realized. Both fail on master (Expected:<0.5>. Actual:<1>) and pass with the fix on Skia Desktop.
  • Given_ItemsControl, Given_ListViewBase, Given_FlipView, Given_ComboBox: 267 passed, 0 failed.

PR Checklist ✅

  • 🧪 Added Runtime tests
  • 📚 Docs
  • 🖼️ Validated PR Screenshots Compare Test Run results.
  • ❗ Contains NO breaking changes

…ixes unoplatform#26423)

Setting ItemContainerStyle or ItemContainerStyleSelector on an ItemsControl
only called Refresh(), which is empty outside the Selector family, so the
containers already realized kept their old style. Re-apply the style to
the realized containers, as WinUI does through RefreshContainers. Like
WinUI, a selector change is ignored while ItemContainerStyle is set.
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@mergify

mergify Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request once it meets the queue conditions

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.

ItemsControl.ItemContainerStyle set after containers are realized is not applied to them

1 participant