menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class SliderTickEventArgs - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class SliderTickEventArgs

    Represents the event arguments for the TicksRender event in the Slider component.

    Inheritance
    System.Object
    SliderTickEventArgs
    Namespace: Syncfusion.Blazor.Inputs
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class SliderTickEventArgs : Object
    Remarks

    This class provides information about individual tick elements during the tick rendering process. It allows customization of tick appearance, text content, and HTML attributes before the ticks are rendered on the slider.

    Examples

    Using SliderTickEventArgs to customize tick rendering:

    <SfSlider @bind-Value="sliderValue" TValue="double" Min="0" Max="100" Step="10">
        <SliderTicks Placement="Placement.After" LargeStep="20" SmallStep="10" ShowSmallTicks="true" />
        <SliderEvents TValue="double" TicksRendering="OnTicksRendering" />
    </SfSlider>
    
    @code {
        private double sliderValue = 30;
    
        private void OnTicksRendering(SliderTickEventArgs args)
        {
            if (args.Value == 50)
            {
                args.Text = "Middle";
                args.HtmlAttributes = new Dictionary<string, object> { { "class", "custom-tick" } };
            }
        }
    }

    Constructors

    SliderTickEventArgs()

    Declaration
    public SliderTickEventArgs()

    Properties

    HtmlAttributes

    Gets or sets the HTML attributes used to customize the tick element.

    Declaration
    public Dictionary<string, object> HtmlAttributes { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.Dictionary<System.String, System.Object>

    A System.Collections.Generic.Dictionary<, > of string keys and object values representing HTML attributes to apply to the tick element. The default value is null.

    Remarks

    This property allows for extensive customization of individual tick elements by applying HTML attributes such as CSS classes, styles, data attributes, or event handlers. The attributes are applied directly to the tick element in the DOM.

    Text

    Gets or sets the label text displayed for the tick.

    Declaration
    public string Text { get; set; }
    Property Value
    Type Description
    System.String

    A string representing the text label for the tick element. The default value is null.

    Remarks

    This property allows customization of the text that appears on individual tick marks. The text can be modified during the TicksRendering event to provide custom labels based on the tick value or other conditions.

    TickElementRef

    Gets or sets the reference to the current tick element being rendered.

    Declaration
    public ElementReference TickElementRef { get; set; }
    Property Value
    Type Description
    Microsoft.AspNetCore.Components.ElementReference

    An Microsoft.AspNetCore.Components.ElementReference to the DOM element representing the current tick that is being rendered.

    Remarks

    This property provides direct access to the tick element's DOM reference, allowing for advanced manipulation or integration with JavaScript interop operations. It can be used to apply custom behaviors or styling that cannot be achieved through standard HTML attributes.

    Value

    Gets or sets the numeric value associated with the tick.

    Declaration
    public double Value { get; set; }
    Property Value
    Type Description
    System.Double

    A double representing the numeric value that the tick represents on the slider scale.

    Remarks

    This property represents the actual numeric value that corresponds to the tick's position on the slider. It is used to determine the tick's placement and can be used in custom logic to conditionally format or style ticks.

    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved