diff --git a/src/Avalonia.Controls/Platform/ScreenHelper.cs b/src/Avalonia.Controls/Platform/ScreenHelper.cs
index 07affb5ecc..0bd2be69d0 100644
--- a/src/Avalonia.Controls/Platform/ScreenHelper.cs
+++ b/src/Avalonia.Controls/Platform/ScreenHelper.cs
@@ -11,7 +11,7 @@ namespace Avalonia.Platform
{
foreach (Screen screen in screens)
{
- if (screen.Bounds.Contains(point))
+ if (screen.Bounds.ContainsExclusive(point))
{
return screen;
}
diff --git a/src/Avalonia.Visuals/Rect.cs b/src/Avalonia.Visuals/Rect.cs
index 6d7d6c2e54..7930228d99 100644
--- a/src/Avalonia.Visuals/Rect.cs
+++ b/src/Avalonia.Visuals/Rect.cs
@@ -252,6 +252,18 @@ namespace Avalonia
return p.X >= _x && p.X <= _x + _width &&
p.Y >= _y && p.Y <= _y + _height;
}
+
+ ///
+ /// Determines whether a point is in the bounds of the rectangle, exclusive of the
+ /// rectangle's bottom/right edge.
+ ///
+ /// The point.
+ /// true if the point is in the bounds of the rectangle; otherwise false.
+ public bool ContainsExclusive(Point p)
+ {
+ return p.X >= _x && p.X < _x + _width &&
+ p.Y >= _y && p.Y < _y + _height;
+ }
///
/// Determines whether the rectangle fully contains another rectangle.