Example #1
0
 private static Rect?GetOwnerRect(Window owner)
 {
     if (owner != null)
     {
         return((Rect)owner.Dispatcher.Invoke(new Func <Rect>(() =>
         {
             var handle = new WindowInteropHelper(owner).Handle;
             Win32Util.GetWindowRect(handle, out Win32Util.RECT windowRect);
             return new Rect()
             {
                 Width = Math.Abs(windowRect.Right - windowRect.Left),
                 Height = Math.Abs(windowRect.Bottom - windowRect.Top),
                 X = windowRect.Left,
                 Y = windowRect.Top,
             };
         })));
     }
     return(null);
 }