public NumericSpinEditor() { TranslatesAutoresizingMaskIntoConstraints = false; var controlSize = NSControlSize.Small; stepper = new NSStepper { TranslatesAutoresizingMaskIntoConstraints = false, ValueWraps = false, ControlSize = controlSize, }; formatter = new NSNumberFormatter { FormatterBehavior = NSNumberFormatterBehavior.Version_10_4, Locale = NSLocale.CurrentLocale, MaximumFractionDigits = 15, NumberStyle = NSNumberFormatterStyle.Decimal, UsesGroupingSeparator = false, }; numericEditor = new NumericTextField { Alignment = NSTextAlignment.Right, Formatter = formatter, TranslatesAutoresizingMaskIntoConstraints = false, Font = NSFont.FromFontName(PropertyEditorControl.DefaultFontName, PropertyEditorControl.DefaultFontSize), ControlSize = controlSize, }; stepper.Activated += (s, e) => { OnStepperActivated(s, e); }; numericEditor.KeyArrowUp += (sender, e) => { IncrementNumericValue(); }; numericEditor.KeyArrowDown += (sender, e) => { DecrementNumericValue(); }; numericEditor.ValidatedEditingEnded += (s, e) => { OnEditingEnded(s, e); }; AddSubview(stepper); AddSubview(numericEditor); this.DoConstraints(new[] { numericEditor.ConstraintTo(this, (n, c) => n.Width == c.Width - 16), numericEditor.ConstraintTo(this, (n, c) => n.Height == 19), stepper.ConstraintTo(numericEditor, (s, n) => s.Left == n.Right + 4), stepper.ConstraintTo(numericEditor, (s, n) => s.Top == n.Top), }); }