views:

27

answers:

2

Hello. I have button. I have expander in button and label above expander in the same button. I can click on button with no problem, but there is problem where I click on label (Nothing happens). How can I make this: When user clicks on label in button, button is being clicked. I want to transfer click event from label to button that contains that label.

<Button>
  <Label />
  <Expander>
  </Expander>
</Button>

I want to be able to click button through label.

+4  A: 

This change should make your label pass through clicks to the underlying control:

<Button>
  <Label IsHitTestVisible="False" />
  <Expander>
  </Expander>
</Button>
Pop Catalin
A: 

You can bubble up the event using RoutingStrategy.Bubble. Here is a starter on routed events -> Routed events

anivas