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.
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.
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.