public override void AttachEvent(string id) { switch (id) { case TextStepper.StepEvent: Control.DownButtonClicked += (sender, e) => { if (ValidDirection.HasFlag(StepperValidDirections.Down)) { Callback.OnStep(Widget, new StepperEventArgs(StepperDirection.Down)); } }; Control.UpButtonClicked += (sender, e) => { if (ValidDirection.HasFlag(StepperValidDirections.Up)) { Callback.OnStep(Widget, new StepperEventArgs(StepperDirection.Up)); } }; break; default: base.AttachEvent(id); break; } }
void TextBox_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Up) { if (ValidDirection.HasFlag(StepperValidDirections.Up)) { Callback.OnStep(Widget, new StepperEventArgs(StepperDirection.Up)); e.Handled = true; } } else if (e.KeyData == Keys.Down) { if (ValidDirection.HasFlag(StepperValidDirections.Down)) { Callback.OnStep(Widget, new StepperEventArgs(StepperDirection.Down)); e.Handled = true; } } }