Пример #1
0
 /// <summary>
 /// 返回最顶层的元素的在dragpoint型坐标。
 /// Returns the top-most element of the given type
 /// at the DragPoint coordinates.
 /// </summary>
 /// <typeparam name="T">The type of the element to be returned.返回元素的类型。</typeparam>
 public T GetElement <T>(System.Windows.Point dragPoint) where T : System.Windows.FrameworkElement
 {
     // 注意:这不是要工作在WinForms!你可以使用扩展方法,将发现根视觉相对第一个参数(这个)。
     // NOTE: This is not going to work in WinForms! You could use the extension method that will find to root visual
     // relatively to the first argument (this).
     return(VisualTreeHelperExtensions.GetElementsInScreenCoordinates <T>(dragPoint).FirstOrDefault());
 }