Class SliderColorRanges
Specifies the collection of color ranges for the slider track, allowing multiple colors to be applied to different segments based on start and end values.
Inherited Members
Namespace: Syncfusion.Blazor.Inputs
Assembly: Syncfusion.Blazor.dll
Syntax
public class SliderColorRanges : SfOwningComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposable
Remarks
The SliderColorRanges component enables you to apply different colors to specific segments of the slider track. Each color range is defined by a start and end value, allowing for visually distinct sections within the slider. This component must be used as a child component within a slider control and contains multiple SliderColorRanges items.
Examples
<SfSlider @bind-Value="SliderValue" Min="0" Max="100" Step="1">
<SliderColorRanges>
<SliderColorRange Color="#ff0000" Start="0" End="25"></SliderColorRange>
<SliderColorRange Color="#ffff00" Start="25" End="50"></SliderColorRange>
<SliderColorRange Color="#00ff00" Start="50" End="75"></SliderColorRange>
<SliderColorRange Color="#0000ff" Start="75" End="100"></SliderColorRange>
</SliderColorRanges>
</SfSlider>
Constructors
SliderColorRanges()
Declaration
public SliderColorRanges()
Methods
BuildRenderTree(RenderTreeBuilder)
Declaration
protected override void BuildRenderTree(RenderTreeBuilder __builder)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderTreeBuilder | __builder |
Overrides
Dispose(bool)
Releases the unmanaged resources used by the component and optionally releases the managed resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing |
|
Overrides
Remarks
This method performs cleanup operations when the component is being disposed. It clears references to the parent slider and the color range collection to prevent memory leaks. The base implementation is called to ensure proper disposal of inherited resources.
OnAfterRenderAsync(bool)
Method invoked after each time the component has been rendered.
Declaration
protected override Task OnAfterRenderAsync(bool firstRender)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | firstRender | Set to |
Returns
| Type | Description |
|---|---|
| Task | A Task representing the asynchronous operation. |
Overrides
Remarks
This method is called after the component has been rendered. On the first render, it updates the parent slider component with the color range configuration. This ensures that the parent slider component receives the color range data and can apply the appropriate styling to the track segments.