WPF Rectangle does not have a Click event

events, shapes, wpf

Solution

If you're not happy with `MouseDown` and `MouseUp`, perhaps you could just put the `Rectangle` in a `Button` and handle the `Button`'s `Click` event?

<Button>
    <Button.Template>
        <ControlTemplate>
            <Rectangle .../>
        </ControlTemplate>
    </Button.Template>
</Button>

It really depends with the behavior you're after. Please elaborate if needs be.

Problem

It seems that the WPF Rectangle shape does not have the Click event defined. What am I supposed to use instead? It does have MouseUp, but it's not quite the same behavior.

Original source

Related problems