Can you find a screen coordinate of cell when DidTapCell is called in SDataGridDelegate?


#1

When I tap on a cell in my grid, I have a little popup that displays on top of the DataGrid.  I would like to display this near where the user taps.  DidTapCell gives me the grid coordinate of what I clicked (which row and column) but is it possible to get the actual screen coordinate of where I clicked?  Or, is there a way for the DataGrid to tell me the screen coordinate of a cell that is it currently displaying?


#2

I ended up finding a work around for my situation.  Here is the sample code that I used (in C# for Xamarin).

float adjustedHeight = Grid.Frame.Y + Grid.ContentOffset.Y;
RectangleF? frame = new RectangleF (screenRect.Size.Width / 4, cell.Row.RowIndex * 45 + 44 + 6 - adjustedHeight, screenRect.Size.Width / 2, 100);

I calculate the row location by figuring out an adjusted height of the scrollpane’s content offset.  I multiplied the row’s index by the height of the row (44, plus 1 more for the height of the divider).  I also added another 44 for the header height and then the 6 is to fine tune my location.