Echilon
Echilon

Reputation: 10244

WPF: Make Whole Border Clickable

I'm trying to implement a button in WPF which shows a menu when you click it. I've got everything working, and the ControlTemplate for the control is shown below. (The control extends ToggleButton).

<Border x:Name="Border" Padding="3" CornerRadius="1" BorderThickness="1"
    VerticalAlignment="Stretch" HorizontalAlignment="Stretch" IsHitTestVisible="True">

The problem is, the menu is only shown when the user clicks the tiny arrow drawn by the path. Is there any way I can make the whole border HitTestVisible?

Upvotes: 13

Views: 5556

Answers (1)

Steven Robbins
Steven Robbins

Reputation: 26599

Adding a transparent background on it should do it.

Upvotes: 21

Related Questions