I think I may have found a solution that usually works:
int[] loc = { 0, 0 };
Rect r = new Rect();
myview.GetLocationOnScreen(loc);
myview.GetWindowVisibleDisplayFrame(r);
loc[0] -= r.Left;
loc[1] -= r.Top;
The last 2 lines adjust loc to be relative to the window. I do not know if my code is the best way to do this, or if it will work for all scenarios, or even if it is completely appropriate, but it seems to work for now for me, so hopefully it can help everyone else too.