NumericUpDown Parent Click Event #2732

Closed
alinateghi opened this Issue Nov 2, 2016 · 1 comment

Projects

None yet

2 participants

@alinateghi

Hello

I used this control in a button. Button has click event so when i try to use up/down buttons, button event fired too. also when i touch other part this issue happen expected the textbox of it.

So, how can prevent parent event ?!

Thanks,
Ali

  • MahApps.Metro v1.3
@punker76
Member
punker76 commented Nov 2, 2016 edited

@alinateghi You can handle/prevent this at the Button's click event.

private async void ButtonClick(object sender, RoutedEventArgs e)
{
    if (e.OriginalSource != sender)
    {
        // do nothing if clicked NumericUpDown parts
        e.Handled = true;
    }
    else
    {
        // handle the button click action
        await this.ShowMessageAsync(string.Empty, "Yeah, you clicked the real button!");
    }
}

buttonclick2

@punker76 punker76 closed this Nov 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment