Example #1
0
 /// <summary>
 /// Retrieves the <see cref="Window"/> to which the specified <see cref="UIElement"/> belongs
 /// </summary>
 /// <param name="element">The <see cref="UIElement"/> to retrieve the parent <see cref="Window"/> of</param>
 /// <returns>The <see cref="Window"/> the specified <see cref="UIElement"/> belongs to</returns>
 public static Window GetWindow(UIElement element)
 {
     IUIElement parent;
     parent = element.Parent;
     while(parent != null)
     {
         if (typeof(Window).IsAssignableFrom(parent.GetType()))
         {
             return (Window)parent;
         }
         else
         {
             parent = ((UIElement)parent).Parent;
         }
     }
     return null;
 }
Example #2
0
 /// <summary>
 /// Computes the x and y offset of the specified window's child <see cref="UIElement"/>
 /// </summary>
 /// <param name="child">The window's child <see cref="UIElement"/> for whihc to compute the offset</param>
 /// <returns>A <see cref="Media.Point"/> representing the window's child x and y offset</returns>
 public Point ComputeChildOffset(UIElement child)
 {
     return new Point();
 }