Open Elbon-Eastmage opened 7 months ago
Check the Button source for how it handles this.
In code-behind, it can be a bit simpler:
void OnPointerReleased(object sender, PointerReleasedEventArgs e)
{
var point = e.GetCurrentPoint(section).Position;
if (section.Bounds.Contains(point))
treasure.IsVisible = !treasure.IsVisible;
}
This may be by-design because there are scenarios where you want IsPointerOver
to be true across the entire interaction and it's easy enough to opt-out of with a small amount of code.
@Elbon-Eastmage are you happy with the provided proposal? If so, we can make this a Q&A rather than a bug report.
That pull request looks perfect! Thank you!
Describe the bug
When IsPointerOver is placed inside an OnPointerReleased event handler, it always returns true, even if the pointer isn't actually over the associated control.
To Reproduce
Expected behavior
Since the pointer wasn't over the visible box when the mouse button was released, the hidden text shouldn't have been shown.
Avalonia version
11.0.10
OS
Windows
Additional context
No response