AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
26.06k stars 2.25k forks source link

DevTools should not add visual elements to its logical tree #17443

Open pavelovcharov opened 2 weeks ago

pavelovcharov commented 2 weeks ago

What does the pull request do?

This PR makes sure that the visual elements are not added to the DevTools logical tree.

What is the current behavior?

Currently in 11.2, visual elements can be added to the DevTools logical tree. This can causes the app's visual tree to break.

    <TabControl>
        <TabItem Header="Item1">
            <Button>button1</Button>
        </TabItem>
        <TabItem Header="Item2">
            <Button>button2</Button>
        </TabItem>
    </TabControl>

https://github.com/user-attachments/assets/cb0a5940-8967-4935-b276-e32d2bab5ee2

What is the updated/expected behavior with this PR?

How was the solution implemented (if it's not obvious)?

Checklist

Breaking changes

Obsoletions / Deprecations

Fixed issues

avaloniaui-bot commented 2 weeks ago

You can test this PR using the following package version. 11.3.999-cibuild0053115-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

cla-avalonia commented 2 weeks ago
pavelovcharov commented 2 weeks ago

@cla-avalonia agree

maxkatz6 commented 2 weeks ago

What problem does it solve?

avaloniaui-bot commented 2 weeks ago

You can test this PR using the following package version. 11.3.999-cibuild0053117-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

pavelovcharov commented 2 weeks ago

@maxkatz6 I've noticed a rather strange bug in v.11.2 - visual elements disappear from the visual tree after inspection with DevTools.

    <TabControl>
        <TabItem Header="Item1">
            <Button>button1</Button>
        </TabItem>
        <TabItem Header="Item2">
            <Button>button2</Button>
        </TabItem>
    </TabControl>

https://github.com/user-attachments/assets/cb0a5940-8967-4935-b276-e32d2bab5ee2

I think it happens because the ContentControl in the ControlDetailsView puts its content in its logical tree. So, I did this PR to make sure that I got it right.

avaloniaui-bot commented 2 weeks ago

You can test this PR using the following package version. 11.3.999-cibuild0053117-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

avaloniaui-bot commented 2 weeks ago

You can test this PR using the following package version. 11.3.999-cibuild0053127-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]