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
602 stars 76 forks source link

FindChild Doesn't Search Expander Header #472

Open adstep opened 3 months ago

adstep commented 3 months ago

Describe the bug

The FindChild methods in FrameworkElementExtensions fail to search for FrameworkElements in the Header of an Expander control. A Framework control is treated as a ContentControl, but the library only recursively searches the Content of the ContentControl, but an ExpanderControl also has an additional Header that gets skipped.

Steps to reproduce

Repro steps:
1. Create an expander control with Header & Content.
2. Put a demo control in the Header to search for.
3. Write a test using VisualUITestBase that loads the control.
4. Attempt to search the Expander control for a sub control under the Header.
5. The search should return an empty result.

Expected behavior

I would expect to be able to find FrameworkElements in the Header of an Expander control using the FindChild methods in FrameworkElementExtensions.

Screenshots

No response

Code Platform

Windows Build Number

Other Windows Build number

No response

App minimum and target SDK version

Other SDK version

No response

Visual Studio Version

2022

Visual Studio Build Number

No response

Device form factor

No response

Additional context

No response

Help us help you

Yes, I'd like to be assigned to work on this item.

Arlodotexe commented 2 months ago

Expander is coming from the platform, so this is something we should be able to test for once we fix #474.