mcpField
S
syncfusion-winforms-range-slider

syncfusion-winforms-range-slider

github.com/syncfusionDesign & UI278 installsUpdated 1w ago
Repository

About syncfusion-winforms-range-slider

A guide to Syncfusion RangeSlider for Windows Forms, aimed at developers who need dual-thumb value-range selection. It explains bounds, styling, orientation, and interaction events.

Key features

  1. 01Select ranges with dual thumbs
  2. 02Configure minimum and maximum bounds
  3. 03Customize track and thumb colors
  4. 04Show ticks and labels
  5. 05Use horizontal or vertical layouts
  6. 06Handle scroll and value-change events

Use cases

  1. 01Filter products by price range
  2. 02Select date ranges for record filtering
  3. 03Adjust scientific or industrial parameters
  4. 04Filter data for analysis

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/syncfusion/winforms-ui-components-skills --skill syncfusion-winforms-range-slider

After installing, type/syncfusion-winforms-range-sliderin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
getting-started.md
interactive-features.md
layout-orientation.md
value-configuration.md

Details

From the project README

Implementing Syncfusion Windows Forms Range Slider

Complete guide for implementing the RangeSlider control in Windows Forms applications. The RangeSlider is a flexible UI component that enables value-range selection with dual thumb controls, allowing users to select from a range of values by moving thumbs along a track.

When to Use This Skill

Use this skill when you need to:

  • Create range selection UI with dual thumbs for minimum and maximum values
  • Configure range bounds with minimum and maximum properties
  • Customize visual appearance with colors, sizes, and tick displays
  • Set initial slider positions using SliderMin and SliderMax properties
  • Handle range selection events for user interactions
  • Support different orientations (horizontal or vertical layouts)
  • Add interactive range controls to Windows Forms applications

Component Overview

The RangeSlider control features:

  • Dual thumb controls for independent minimum/maximum selection
  • Configurable range bounds from Minimum to Maximum properties
  • Color customization for channel, range, and thumb elements
  • Tick display with configurable frequency
  • Horizontal and vertical orientations for flexible layout
  • Event handling for scroll and value change interactions
  • Visual highlighting of selected range between thumbs

Navigation Guide

Getting Started

📄 Read: references/getting-started.md

  • Assembly deployment and NuGet installation
  • Adding via designer
  • Adding via code (C# and VB.NET examples)
  • Basic configuration with minimum/maximum values
Value Configuration

📄 Read: references/value-configuration.md

  • Setting SliderMin and SliderMax positions
  • Configuring Minimum and Maximum bounds
  • Understanding Range property
  • Practical value setup examples
Interactive Features

📄 Read: references/interactive-features.md

  • Channel color and height customization
  • Range color highlighting
  • Thumb color configuration
  • Slider size adjustment
  • Tick display and frequency control
  • Event handling (Scroll and ValueChanged events)
Layout and Orientation

📄 Read: references/layout-orientation.md

  • Horizontal vs vertical orientation
  • Right-to-left (RTL) support
  • Orientation property usage
  • Layout considerations and best practices

Quick Start Example

Here's a minimal example to get started with RangeSlider:

using Syncfusion.Windows.Forms.Tools;
using System.Windows.Forms;

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
        
        // Create RangeSlider instance
        RangeSlider rangeSlider = new RangeSlider();
        
        // Configure range bounds
        rangeSlider.Minimum = 0;
        rangeSlider.Maximum = 100;
        
        // Set initial thumb positions
        rangeSlider.SliderMin = 20;
        rangeSlider.SliderMax = 80;
        
        // Show value labels
        rangeSlider.ShowLabels = true;
        
        // Display ticks
        rangeSlider.ShowTicks = true;
        rangeSlider.TickFrequency = 10;
        
        // Add to form
        this.Controls.Add(rangeSlider);
    }
}

Common Patterns

Pattern 1: Price Range Filter

Create a price range selector with custom formatting:

rangeSlider.Minimum = 0;
rangeSlider.Maximum = 1000;
rangeSlider.SliderMin = 100;
rangeSlider.SliderMax = 900;

rangeSlider.ValueChanged += (s, e) =>
{
    decimal minPrice = rangeSlider.SliderMin;
    decimal maxPrice = rangeSlider.SliderMax;
    // Update product list based on price range
};
Pattern 2: Custom Visual Styling

Customize colors for visual feedback:

// Set distinct colors for visual hierarchy
rangeSlider.ChannelColor = Color.LightGray;      // Background track
rangeSlider.RangeColor = Color.DarkGreen;        // Selected range
rangeSlider.ThumbColor = Color.Green;            // Thumb controls

// Adjust sizing
rangeSlider.ChannelHeight = 6;
rangeSlider.SliderSize = new Size(12, 18);
Pattern 3: Vertical Layout

Create vertical range sliders for specific layouts:

rangeSlider.Orientation = Orientation.Vertical;
rangeSlider.Height = 300;  // Sufficient height for vertical orientation
rangeSlider.Width = 50;    // Narrower for vertical
Pattern 4: Event-Driven Updates

Handle user interactions with events:

rangeSlider.Scroll += (s, e) =>
{
    // Called while user is dragging
    UpdatePreview();
};

rangeSlider.ValueChanged += (s, e) =>
{
    // Called after value change completes
    UpdateData();
};

Key Properties Reference

PropertyTypePurpose
MinimumintDefines the lower bound of range
MaximumintDefines the upper bound of range
SliderMinintPosition of left/top thumb (current minimum)
SliderMaxintPosition of right/bottom thumb (current maximum)
Rangerange structureGets current selected range
ChannelColorColorBackground track color
RangeColorColorHighlighted selected range color
ThumbColorColorThumb control color
ChannelHeightintHeight of track in pixels
SliderSizeSizeDimensions of thumb controls
ShowTicksboolDisplay tick marks
TickFrequencyintInterval between ticks
OrientationOrientationHorizontal or Vertical layout
ShowLabelsboolDisplay value labels
RightToLeftRightToLeftRTL layout support

Design Patterns

Responsive Range Selection

Create controls that adapt to user needs:

public void ConfigureRangeSlider(int dataMin, int dataMax, int defaultMin, int defaultMax)
{
    rangeSlider.Minimum = dataMin;
    rangeSlider.Maximum = dataMax;
    rangeSlider.SliderMin = defaultMin;
    rangeSlider.SliderMax = defaultMax;
    
    // Calculate appropriate tick frequency
    int range = dataMax - dataMin;
    rangeSlider.TickFrequency = range > 1000 ? 100 : range > 100 ? 10 : 1;
}
Validation Pattern

Ensure valid range selections:

rangeSlider.ValueChanged += (s, e) =>
{
    if (rangeSlider.SliderMin > rangeSlider.SliderMax)
    {
        // Swap if needed
        int temp = rangeSlider.SliderMin;
        rangeSlider.SliderMin = rangeSlider.SliderMax;
        rangeSlider.SliderMax = temp;
    }
};

Common Use Cases

Price Range Filtering

Enable users to filter products by selecting a price range, commonly used in e-commerce applications.

Date Range Selection

Create date range pickers by mapping slider values to date ranges for filtering historical data.

Parameter Calibration

Allow configuration of minimum and maximum parameters in scientific or industrial applications.

Volume Control

Use range sliders for audio applications to set volume range or frequency bands.

Data Analysis

Filter large datasets by selecting value ranges for visualization and analysis.

Best Practices

  1. Set clear bounds - Always define Minimum and Maximum before adding to form
  2. Provide visual feedback - Use colors to indicate selected range clearly
  3. Display ticks and labels - Help users understand scale and current values
  4. Handle both events - Use Scroll for preview, ValueChanged for final updates
  5. Responsive design - Adjust TickFrequency based on range size
  6. Consider orientation - Choose horizontal for compact layouts, vertical for specialized UIs

Next Steps: Read the appropriate reference guide from the Navigation Guide above based on your specific implementation needs.

Comments

Markdown supported