How to block parent events when a child is clicked

for example, when I click the button, the grid event also fires. How can i avoid this?

<Grid Tap="Grid_Tap">
    <Button Click="btn_Click" />
</Grid>
+4
source share
1 answer

set e.Handled = true; in the button handler

void Button_Click_1(object sender, RoutedEventArgs e)
    {
        //Handler code here
        e.Handled = true;
    }

Handled

+4
source

All Articles