WPF: OnRender and Hit Testing
- by stefan.at.wpf
Hello,
when using OnRender to draw something on the screen, is there any way to perform Hit Testing on the drawn graphics?
Sample Code
protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
{
base.OnRender(drawingContext);
drawingContext.DrawRectangle(Brushes.Black, null, new Rect(50, 50, 100, 100));
}
Obviously one has no reference to the drawn Rectangle which would be necessary to perform hit testing or am I wrong about this? I know I can use DrawingVisual, I'm just curious if my understanding is correct, that using OnRender to draw something you can't perform any hit testing on the drawn things?