Windows icon indicating copy to clipboard operation
Windows copied to clipboard

Add more details on various scenarios for DockPanel

Open michael-hawker opened this issue 2 years ago • 3 comments

michael-hawker avatar Jul 11 '23 16:07 michael-hawker

@michael-hawker

It appears that the current implementation of DockPanel does not process children with Visiblity = Collapsed during initialization, meaning when they become visible they are added to the DockPanel in an unexpected order.

Can you confirm if this is the desired behavior here?

kmgallahan avatar Oct 26 '23 13:10 kmgallahan

@kmgallahan ah interesting. I don't think we have good coverage/implementation/expectations in most panels for supporting hidden children (either at initialization or dynamically).

Would certainly be something to audit across the panels and add more tests for. I was hoping we'd be able to do some of that leading into release, but we ran out of time.

If you have a specific scenario/example that's failing, please raise a new issue and feel free to submit a fix, if you have one. Thanks!

michael-hawker avatar Oct 27 '23 03:10 michael-hawker

A common scenario would be starting an app with layout management similar to that found in Visual Studio. On launch, some panels may be hidden, to be later shown via toggles or triggers.

Without debugging or prior knowledge, looking at the source I see children are processed by index:

https://github.com/CommunityToolkit/Windows/blob/82eb9a9e066c877ff2eb31768cb2ea995f1af0b7/components/Primitives/src/DockPanel/DockPanel.cs#L45

Not sure why or if child index values change as their visibility changes. Perhaps starting with Visibility="Collapsed" means they only get added to the UIElementCollection once visible?

If that's the case then we'd need to get the children by XAML order... not sure how to do that.

kmgallahan avatar Oct 28 '23 12:10 kmgallahan