Is there any better way to detect hit in hollowed Path?

Emon Haque 3,176 Reputation points
2021-04-23T01:47:14.847+00:00

The MouseUp Event on the Path works fine this way:

rightIcon = new Path() {
    Fill = brush,
    Data = Geometry.Parse(iconData),
    Stretch = Stretch.Uniform
};
var rightIconBorder = new Border() {
    Background = Brushes.Transparent,
    Child = rightIcon
};
rightIconBorder.MouseUp += showPopup;

BUT I've to wrap the hollowed Path in a container with Transparent background and attach event on the container instead of Path. If I don't wrap the Path with a container, with Transparent background, MouseUp event doesn't work if I click on holes.

Is it possible to get MouseUp anywhere on hollowed Path without wrapping it with another container?

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,687 questions
{count} votes