public class NumericInputA field that holds a number, with arrows and a drag to scrub it.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The number is the value and the text is a rendering of it. Value is still a string — it is a field, and half-typed input like - or 1. has to be allowed to exist for as long as somebody is typing it — but Number is what the application reads, and it is only ever assigned from text that parses.
⚠ Dragging scrubs only while the field is not focused, and that is the whole trick. A field the user is editing has to let them select text with the pointer; a field they are not editing has nothing to select, so the drag is free for something better. It is what every 3D application's inspector does, and it is why a click that does not move still focuses the field: the two gestures start identically and are told apart by whether anything happened next.
⚠ One pixel is worth a percentage of the number, not a fixed amount of it. A field that always moved by Step was dead on anything large: a directional light is a hundred thousand lux, and a scrub that shifted it by one moved it by a thousandth of a percent per pixel. The light was only the messenger — a range in centimetres, a budget in bytes and a distance in metres all have the same shape — so the cure is in the arithmetic rather than in a number chosen per member. See RelativeStep.
⚠ The spinners this summary used to claim are Stepper's, and until it existed they were nobody's. The line above said "arrows, spinners and a drag" and the control had two of the three; the theme's read-only rule named "numeric-input's spinners" as well. What was true is that Nudge — the mechanism a pair of buttons needs — was finished and had nothing pressing it.
⚠ Not sealed, and Stepper is the only reason. A stepper is this field with two buttons in it: the number, the range, the step, the arrow keys and the scrub are all here already, and a separate control beside a field would have had to mirror every one of them and keep the mirror in step.
Fields and properties (17)
protected override string TagNameThe element name this type answers to when a caller does not choose one.
protected override AccessibleRole NativeRolepublic double Numberpublic double Minimumpublic double Maximumpublic double Steppublic double RelativeSteppublic int Decimalspublic CultureInfo? CultureWhich locale the number is written and read in. null is invariant.
public string? FormatA .NET numeric format string — "N0", "C2", "P1", "#,##0.###". null is F{Decimals}.
public bool IsInRangeWhether Number is inside the bounds the field declares.
public static readonly UiPropertyKey NumberPropertyIdentity for Number.
public static readonly UiPropertyKey MinimumPropertyIdentity for Minimum.
public static readonly UiPropertyKey MaximumPropertyIdentity for Maximum.
public static readonly UiPropertyKey StepPropertyIdentity for Step.
public static readonly UiPropertyKey RelativeStepPropertyIdentity for RelativeStep.
public static readonly UiPropertyKey DecimalsPropertyIdentity for Decimals.
Events (1)
public Action<NumericInput, double>? NumberChangedRaised when the number changes.
Methods (12)
protected override void OnCreated()Builds whatever this element is made of, once, as it joins a document.
public void Nudge(double steps)Adds a number of steps to the value.
protected override string? Coerce(string? value)protected override string? Validate(string? value)protected override void OnSubmit()protected override void SelectAt(int index, int count)public void ClearNumber()Unsets Number, so it takes its default or its ancestor's value again.
public void ClearMinimum()Unsets Minimum, so it takes its default or its ancestor's value again.
public void ClearMaximum()Unsets Maximum, so it takes its default or its ancestor's value again.
public void ClearStep()Unsets Step, so it takes its default or its ancestor's value again.
public void ClearRelativeStep()Unsets RelativeStep, so it takes its default or its ancestor's value again.
public void ClearDecimals()Unsets Decimals, so it takes its default or its ancestor's value again.
Used by (48, showing 40)
- GalleryHelloUi
- AccessibilityTreeTestsVixen.Ui.Controls.Tests
- ConvertedVixen.Ui.Controls.Tests
- ElementStateBitTestsVixen.Ui.Controls.Tests
- FormVixen.Ui.Controls.Tests
- LabeledContentTestsVixen.Ui.Controls.Tests
- NestedMemberTestsVixen.Ui.Controls.Advanced.Tests
- NodeCanvasKeyboardTestsVixen.Ui.Controls.Advanced.Tests
- NodeCanvasTestsVixen.Ui.Controls.Advanced.Tests
- NodePortEditorVixen.Ui.Controls.Advanced
- PropertyGridVixen.Ui.Controls.Advanced
- PropertyGridTestsVixen.Ui.Controls.Advanced.Tests
- ScrubTestsVixen.Ui.Controls.Tests
- StepperVixen.Ui.Controls
- StepperTestsVixen.Ui.Controls.Tests
- TextFieldTestsVixen.Ui.Controls.Tests
- TwoWayTypeTestsVixen.Ui.Controls.Tests
- AnimationClipViewVixen.Editor.AssetEditors
- AnimationGraphViewVixen.Editor.AssetEditors
- AudioMixerViewVixen.Editor.AssetEditors
- ChromeFixtureVixen.Editor.Ui.Tests
- ComponentDrawerVixen.Editor.Inspector
- CompositorViewVixen.Editor.AssetEditors
- DrawerTestsVixen.Editor.Inspector.Tests
- EditorAffordanceTestsVixen.Editor.App.Tests
- FontViewVixen.Editor.AssetEditors
- FontViewTestsVixen.Editor.AssetEditors.Tests
- InspectorFixtureVixen.Editor.Inspector.Tests
- LayerStackEditingTestsVixen.Editor.Texturing.Tests
- LayerStackKnobWidthTestsVixen.Editor.Texturing.Tests
- LayerStackViewVixen.Editor.Texturing
- MarkupBindingVixen.Editor.Inspector
- MarkupBindingTestsVixen.Editor.Inspector.Tests
- MaterialGraphPropertyTestsVixen.Editor.AssetEditors.Tests
- MaterialViewVixen.Editor.AssetEditors
- MoveSetViewVixen.Editor.AssetEditors
- NodeInspectorDumpTestsVixen.Editor.NodeGraph.Tests
- NodePortProviderTestsVixen.Editor.NodeGraph.Tests
- NumberDrawerVixen.Editor.Inspector
- PaintBrushInspectorVixen.Editor.Texturing