New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NumericUpDown Parent Click Event #2732

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

Comments

Projects
None yet
2 participants
@alinateghi

alinateghi commented Nov 2, 2016

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

This comment has been minimized.

Show comment
Hide comment
@punker76

punker76 Nov 2, 2016

Member

@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

Member

punker76 commented Nov 2, 2016

@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