Browse Source
* test(grid): reproduce shared size groups ignoring assigned definitions Definitions supplied through the ColumnDefinitions or RowDefinitions setter are already in the collection when the grid claims it, so they never pass through the collection-changed handler that joins them to the parent tree. They never register with their shared size group, and the definitions they replace never unregister from it. * fix(grid): join assigned definition collections to the parent tree DefinitionList.SetParent assigned each definition's Parent but never called OnEnterParentTree, which only ran from the collection-changed handler. Assigning Parent is not sufficient: OnEnterParentTree also sets InheritanceParent, and a definition cannot read the inherited PrivateSharedSizeScope that registers it with its group until that link exists. Definitions supplied through the ColumnDefinitions setter - an object initializer, a shared resource, or ColumnDefinitions="Auto,*" - were therefore silently absent from their shared size group. Enter and exit the parent tree from SetParent, and release the outgoing collection when Grid swaps one in. Without that release the replaced definitions stay registered with the group; nothing resets their measured minimum any more, so they pin it at whatever they last contributed. * test(grid): cover the definition ownership contract Removing a definition leaves it holding its old Parent and its property inheritance link, so it still reads the grid's shared size scope and can re-register itself into a scope it has left. Also covers moving a definition between grids, reassigning the same collection, and row definitions, which the assignment fix reached but nothing exercised. * refactor(grid): centralise definition parent-tree transitions Definition ownership was implemented twice, and the two paths disagreed: SetParent exited a definition and cleared its Parent, while removing one from the collection called OnExitParentTree but left Parent set. Detach was incomplete either way, since OnEnterParentTree establishes InheritanceParent but OnExitParentTree never cleared it - so a removed definition kept reading the grid's inherited PrivateSharedSizeScope, and the grid kept it alive as an inheritance child. Route every owner change through one transition that exits the old tree, assigns Parent, and enters the new one, and clear InheritanceParent on exit so detach mirrors attach. --------- Co-authored-by: Julien Lebosquain <julien@lebosquain.net>pull/21868/head
committed by
GitHub
4 changed files with 292 additions and 12 deletions
Loading…
Reference in new issue