CommunityToolkit / Windows

Collection of controls for WinUI 2, WinUI 3, and Uno Platform developers. Simplifies and demonstrates common developer tasks building experiences for Windows with .NET.
https://aka.ms/windowstoolkitdocs
Other
582 stars 70 forks source link

Add more details on various scenarios for DockPanel #129

Open michael-hawker opened 1 year ago

kmgallahan commented 1 year ago

@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?

michael-hawker commented 1 year ago

@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!

kmgallahan commented 1 year ago

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.