BnSlider
Namespace: BlazorNative.Components
A slider for picking a number from a range. Renders as a native
SeekBar on Android and a UISlider on iOS.
public class BnSlider : Microsoft.AspNetCore.Components.ComponentBase, Microsoft.AspNetCore.Components.IComponent, Microsoft.AspNetCore.Components.IHandleEvent, Microsoft.AspNetCore.Components.IHandleAfterRender
Inheritance Object → ComponentBase → BnSlider
Implements IComponent, IHandleEvent, IHandleAfterRender
Attributes NullableContextAttribute, NullableAttribute
Remarks:
The range is declared, not inherited: Min defaults to 0 and
Max to 100, and both always travel to the platform, so the two
never disagree about what the track means. Step is optional — leave it
unset for a continuous slider.
Its intrinsic height is the platform's, but its natural width is not something you should rely on: give it a Width (or let a flex parent size it) whenever the exact width matters.
<BnSlider @bind-Value="_volume" Min="0" Max="100" Step="5" Width="240" />
@code {
private float _volume = 25f;
}
Properties
Value
The current value, between BnSlider.Min and BnSlider.Max.
public float Value { get; set; }
Property Value
ValueChanged
Raised with the new value as the user drags — the write-back
half of the @bind-Value pair.
public EventCallback<float> ValueChanged { get; set; }
Property Value
Min
Lower bound of the range. Default 0.
public float Min { get; set; }
Property Value
Max
Upper bound of the range. Default 100.
public float Max { get; set; }
Property Value
Step
Snap increment — the value moves in multiples of this. Null = continuous.
public float? Step { get; set; }
Property Value
Enabled
Set false to show the platform's disabled slider and stop it responding. Default true.
public bool Enabled { get; set; }
Property Value
BackgroundColor
Background color as a hex string, e.g. "#FFEEAA". Null
leaves the view transparent.
public string? BackgroundColor { get; set; }
Property Value
Margin
Outside spacing, e.g. "8" — space between this view's box
and its siblings. Null = none.
public string? Margin { get; set; }
Property Value
AlignSelf
Cross-axis override for this item (alignSelf). Null = auto
(inherit the parent's BnView.Align).
public FlexAlign? AlignSelf { get; set; }
Property Value
Grow
Share of the free main-axis space this item absorbs
(flexGrow) — a UNITLESS number, not a length. Null = 0.
public float? Grow { get; set; }
Property Value
Shrink
Share of the main-axis overflow this item gives back
(flexShrink) — a UNITLESS number. Null = Yoga's default.
public float? Shrink { get; set; }
Property Value
Basis
Main-axis base size (flexBasis): "auto" | "50%"
| "120". Null = auto.
public string? Basis { get; set; }
Property Value
Width
Width, e.g. "300" or "50%". Null = auto.
public string? Width { get; set; }
Property Value
Height
Height, e.g. "100" or "50%". Null = auto.
public string? Height { get; set; }
Property Value
MinWidth
Minimum width. Null = unset.
public string? MinWidth { get; set; }
Property Value
MaxWidth
Maximum width. Null = unset.
public string? MaxWidth { get; set; }
Property Value
MinHeight
Minimum height. Null = unset.
public string? MinHeight { get; set; }
Property Value
MaxHeight
Maximum height. Null = unset.
public string? MaxHeight { get; set; }
Property Value
Position
Positioning mode (position). Null = relative (in flow).
public FlexPosition? Position { get; set; }
Property Value
Top
Top inset. Null = unset.
public string? Top { get; set; }
Property Value
Right
Right inset. Null = unset.
public string? Right { get; set; }
Property Value
Bottom
Bottom inset. Null = unset.
public string? Bottom { get; set; }
Property Value
Left
Left inset. Null = unset.
public string? Left { get; set; }
Property Value
Constructors
BnSlider()
public BnSlider()