Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DevTools overlay only shows while hovering text in control tree #14230

Closed
AtomCrafty opened this issue Jan 16, 2024 · 2 comments · Fixed by #14231
Closed

DevTools overlay only shows while hovering text in control tree #14230

AtomCrafty opened this issue Jan 16, 2024 · 2 comments · Fixed by #14231

Comments

@AtomCrafty
Copy link
Contributor

AtomCrafty commented Jan 16, 2024

While hovering over an element in the DevTools control tree, the corresponding element is highlighted in the application window. However this only happens while the mouse cursor is positioned over the actual text (the control type name, class list or element name). It's pretty annoying, especially with controls like Grid or Panel, since the type name is so short you actually have to aim to hit the text.

The reason for the current behavior is that the AddAdorner and RemoveAdorner event handlers are added to the stack panel containing the text elements, but that stack panel doesn't have a background set, so only its children receive pointer events.

<StackPanel Orientation="Horizontal" Spacing="8"
PointerEntered="AddAdorner"
PointerExited="RemoveAdorner">
<TextBlock Text="{Binding Type}" FontWeight="{Binding FontWeight}"/>
<TextBlock Text="{Binding Classes}"/>
<TextBlock Foreground="Gray" Text="{Binding ElementName}"/>
</StackPanel>

An easy improvement would be to just add a transparent background, but that still isn't a perfect solution. The stack panel doesn't cover the full height of the tree view item, so when moving the mouse from one item to the next the adorner flickers, even if both controls have the same bounds. Also hovering the chevron or the area left to it would still not show the adorner

Ideally the event handlers would be attached to the TreeViewItem itself, but without event setters I'm not sure how one would do that.

image

@timunie
Copy link
Contributor

timunie commented Jan 16, 2024

probably the event can be added to the TreeView itself. e.Sender could point to the control that first send the event.

@AtomCrafty
Copy link
Contributor Author

Yeah that appears to work. I'll get a PR ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants