// <SnippetContainerVisualSnippet2> // Capture the mouse event and hit test the coordinate point value against // the child visual objects. void MyVisualHost_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e) { // Retrieve the coordinates of the mouse button event. Point pt = e.GetPosition((UIElement)sender); // Initiate the hit test on the ContainerVisual's visual tree. HitTestResult result = _containerVisual.HitTest(pt); // Perform the action on the hit visual. if (result.VisualHit != null) { ProcessHitVisual((Visual)result.VisualHit); } }