private dfMarkupTag hitTestTag(dfMouseEventArgs args) { var relativeMousePosition = this.GetHitPosition(args) + scrollPosition; var hitBox = viewportBox.HitTest(relativeMousePosition); if (hitBox != null) { var tag = hitBox.Element; while (tag != null && !(tag is dfMarkupTag)) { tag = tag.Parent; } return(tag as dfMarkupTag); } return(null); }