1

I have a winForm, in which have a requirement to use Silder that could slide on DateTime and grid is refreshed according to the date selected.

Is there any control that provides above functionality.

Thanks in advance.

Sergey Berezovskiy
  • 232,247
  • 41
  • 429
  • 459
DS2020
  • 279
  • 1
  • 4
  • 20

1 Answers1

0

Yes, this control has name TrackBar. You can use it without labels:

DateTime beginDate = //
DateTime endDate = //
datesTrackBar.Maximum = (int)(endDate - beginDate).TotalDays;

And filter your grid on Scroll event:

private void datesTrackBar_Scroll(object sender, EventArgs e)
{
    DateTime selectedDate = beginDate.AddDays(datesTrackBar.Value);
    // filter grid
}

Or you can create your own TimeSlider control via inheriting from TrackBar and overriding it's OnPaint event.

Here you can see an example of creating custom slider.

Sergey Berezovskiy
  • 232,247
  • 41
  • 429
  • 459