Class NumericProperty<TValue, TField>
A labelled numeric property row: a scrubbable label paired with a numeric field, both driven by a single value.
Inheritance
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
public abstract class NumericProperty<TValue, TField> : InputLabel, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IContextOverrideElement, IAdditionalDataHolder, IInputElement<TValue>, IValidatableElement<TValue>, INotifyValueChanged<TValue>, ISizeableElement where TValue : struct, IComparable, IComparable<TValue>, IFormattable where TField : NumericalField<TValue>, new()
Type Parameters
| Name | Description |
|---|---|
| TValue | The numeric value type. |
| TField | The NumericalField<TValue> implementation used as the value editor. |
Remarks
NumericProperty is the inspector row of the design system. It derives from InputLabel, so it inherits the whole label/input layout — direction, required indicator, help text, leading icon and capValue — and it owns the NumericalField<TValue> placed inside it.
The point of the type is that the label drag-scrub cannot be forgotten:
draggable defaults to true here, so dragging the label
horizontally always adjusts the field (Shift for a coarse step, Alt for a fine one). Build
the same row by hand out of an InputLabel and a field and you can ship one whose label
silently does nothing.
Scalar only. Vector, rect and bounds rows scrub per-axis on their own sub-field labels, so pair those with a plain InputLabel.
Use the concrete NumericPropertyFloat and NumericPropertyInt.
Constructors
NumericProperty()
Default constructor.
Declaration
protected NumericProperty()
Fields
fieldUssClassName
The NumericProperty field styling class.
Declaration
public const string fieldUssClassName = "appui-numericproperty__field"
Field Value
| Type | Description |
|---|---|
| string |
ussClassName
The NumericProperty main styling class.
Declaration
public const string ussClassName = "appui-numericproperty"
Field Value
| Type | Description |
|---|---|
| string |
Properties
field
The numeric field used as the value editor.
Declaration
public TField field { get; }
Property Value
| Type | Description |
|---|---|
| TField |
formatString
The format string applied to the displayed value.
Declaration
[CreateProperty]
[UxmlAttribute]
public string formatString { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
highValue
The maximum allowed value, clamped on both a typed edit and a scrub.
Declaration
[CreateProperty]
[UxmlAttribute]
public Optional<TValue> highValue { get; set; }
Property Value
| Type | Description |
|---|---|
| Optional<TValue> |
invalid
The invalid state of the property.
Declaration
[CreateProperty]
[UxmlAttribute]
public bool invalid { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
lowValue
The minimum allowed value, clamped on both a typed edit and a scrub.
Declaration
[CreateProperty]
[UxmlAttribute]
public Optional<TValue> lowValue { get; set; }
Property Value
| Type | Description |
|---|---|
| Optional<TValue> |
size
The size of the numeric field.
Declaration
[CreateProperty]
[UxmlAttribute]
public Size size { get; set; }
Property Value
| Type | Description |
|---|---|
| Size |
unit
The unit suffix displayed by the numeric field. The suffix is a second scrub handle.
Declaration
[CreateProperty]
[UxmlAttribute]
public string unit { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
validateValue
The validation function applied to the value.
Declaration
[CreateProperty]
public Func<TValue, bool> validateValue { get; set; }
Property Value
| Type | Description |
|---|---|
| Func<TValue, bool> |
value
The value of the property.
Declaration
[CreateProperty]
[UxmlAttribute]
public TValue value { get; set; }
Property Value
| Type | Description |
|---|---|
| TValue |
Methods
SetValueWithoutNotify(TValue)
Set the value without notifying the listeners.
Declaration
public void SetValueWithoutNotify(TValue newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| TValue | newValue | The new value. |