1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-11-29 10:50:28 +00:00

Fix ListView click locator

The code that figures out which row and column you clicked in wasn't
taking horizontal scrolling into account.  Issue #49.
This commit is contained in:
Andy McFadden 2019-10-06 10:46:55 -07:00
parent 710a8dc679
commit 951c0d7936

View File

@ -147,9 +147,13 @@ namespace CommonWPF {
// for it, so for now just fudge it. // for it, so for now just fudge it.
const int FUDGE = 4; const int FUDGE = 4;
// Need to take horizontal scrolling into account.
ScrollViewer sv = lv.GetVisualChild<ScrollViewer>();
double scrollPos = sv.HorizontalOffset;
Point p = e.GetPosition(lv); Point p = e.GetPosition(lv);
GridView gv = (GridView)lv.View; GridView gv = (GridView)lv.View;
double startPos = FUDGE; double startPos = FUDGE - scrollPos;
for (int index = 0; index < gv.Columns.Count; index++) { for (int index = 0; index < gv.Columns.Count; index++) {
GridViewColumn col = gv.Columns[index]; GridViewColumn col = gv.Columns[index];