System.Windows.Rect.Contains C# (CSharp) Method

Contains() public method

public Contains ( Point point ) : bool
point Point
return bool
        public bool Contains(Point point)
        {
            return this.Contains(point._x, point._y);
        }

Same methods

Rect::Contains ( Rect rect ) : bool
Rect::Contains ( double x, double y ) : bool

Usage Example

Example #1
1
 /// <summary>
 /// Returns a value indicating whether a point is inside the bounding box of the element.
 /// </summary>
 /// <param name="element"></param>
 /// <param name="pointRelativeToElement"></param>
 /// <returns></returns>
 public static bool ContainsPoint(this FrameworkElement element, Point pointRelativeToElement)
 {
     //TODO: Silverlight allows more complex geometries than Rectangle.
     Rect rect = new Rect { X = 0, Y = 0, Width = element.ActualWidth, Height=element.ActualHeight };
     
     return rect.Contains(pointRelativeToElement);            
 }
All Usage Examples Of System.Windows.Rect::Contains