We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How to add Range Slider in grid control?

Hi,

I am trying to add Range slider into grid cell like Trackbar but rendering is not happing properly and I don't know how to remember the slider min & max values and range slider cell back color is always coming black. Please help me to resolve this problem.

Please find sample from the attachment.



RangeSliderExample_cf3ea0b5.zip

5 Replies

AS Athiram S Syncfusion Team November 8, 2012 10:13 AM UTC

Hi Neeraj,

Thank you for your interest in Syncfusion Products.

It is possible to the set the minimum and maximum value using Minimum and Maximum property. The current trackbar value can be retrived using Value  property. Please refer the folllowing code snippet:

this.trackBar1.Minimum = 3;
this.trackBar1.Maximum = 15;
this.trackBar1.TickFrequency = 3;
this.label1.Text = this.trackBar1.Value.ToString();

Please let me know if any concerns.

Regards,
Athiram S


NK Neeraj Kumar November 8, 2012 10:18 AM UTC

Hi,

Trackbar is working properly , i want to add range slider (Trackbar with 2 sliders) as custom cell. Please check the attached project , rendering is not happening properly and i don't know how remember the SiderMin and SliderMax property in custom cell.


AS Athiram S Syncfusion Team November 9, 2012 10:28 AM UTC

Hi Neeraj,

Thanks for the interst in Syncfusion products.

You can set slider control in your grid with the help of following code.

<code>
gridControl1.CellModels.Add("Slider", new SliderCellModel(gridControl1.Model));
            gridControl1[2, 2].CellType = "Slider";
            GridStyleInfo style;
            SliderStyleProperties sp;
            style = gridControl1[2,2];
            sp = new SliderStyleProperties(style);
            int max = (sp.Maximum = 10);
            int min = (sp.Minimum = 1);
            gridControl1[2,1].Text = min.ToString();
            gridControl1[2, 3].Text = max.ToString();
</code

And you can get the value of the Slider, handling CurrentCellChanged event as follows.

<code>   
    private void gridControl1_CurrentCellChanged(object sender, EventArgs e)
        {
            string s;
            GridCurrentCell cc = gridControl1.CurrentCell;
            GridCellRendererBase renderer = cc.Renderer;
            if (cc.RowIndex == 2 & cc.ColIndex==2)
            {
                s = renderer.ControlValue.ToString();
                Console.WriteLine("Slider Value --> " + s);
                gridControl1[1, 2].Text = s;
            }
        }
</code>

Please refer the sample in the below link that illustrates the above.

http://websamples.syncfusion.com/samples/Grid.Windows/I42133_BB/main.htm

Please let me know if you have any questions.

Regards,
Athiram S


NK Neeraj Kumar November 9, 2012 10:47 AM UTC

Hi,

Thank you for your reply.

Unfortunately the given link is not loading for me?.Please can you check it.


AS Athiram S Syncfusion Team November 9, 2012 12:23 PM UTC

Hi Neeraj,

Sorry for the inconvenience.

Please make use of following links for your reference:

http://help.syncfusion.com/UG/User%20Interface/Windows%20Forms/Grid/default.htm#!Documents/41449slider.htm

http://help.syncfusion.com/UG/User%20Interface/Windows%20Forms/Grid/default.htm#!Documents/414115slider.htm
Please let me know if you have any concerns.

Regards,
Athiram S

Loader.
Live Chat Icon For mobile
Up arrow icon