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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to add Range Slider in grid control?

Thread ID:

Created:

Updated:

Platform:

Replies:

105625 Nov 6,2012 01:49 PM UTC Nov 9,2012 12:23 PM UTC Windows Forms 5
loading
Tags: GridControl
Neeraj Kumar
Asked On November 6, 2012 01:49 PM UTC

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

Athiram S [Syncfusion]
Replied On 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

Neeraj Kumar
Replied On 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.

Athiram S [Syncfusion]
Replied On 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

Neeraj Kumar
Replied On 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.

Athiram S [Syncfusion]
Replied On 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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;