This is a migrated thread and some comments may be shown as answers.

Scroll to time

18 Answers 232 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Karl
Top achievements
Rank 1
Karl asked on 24 Feb 2012, 05:53 PM
Hi,

Is there away to scroll to a particular time? I need to have a 24 hour day but scroll to a timeslot. Say 8 am and then if possible scroll to the next available time slot? Is this possible? I've seen some articles on the AJAX controls but hardly anything on winforms.

Thanks

18 Answers, 1 is accepted

Sort by
0
Ivan Todorov
Telerik team
answered on 29 Feb 2012, 12:31 PM
Hello Karl,

Thank you for writing.

Yes, there is a way to scroll to a specific hour. The following code snippet demonstrates this:
SchedulerDayViewElement dayViewElement = this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewElement;
 
if (dayViewElement != null)
{
    //scrolls dayview or weekview to the specified time slot
    dayViewElement.DataAreaElement.Table.ScrollToTime(new TimeSpan(DateTime.Now.Hour, 0, 0));
}

In case you need to scroll to a specific appointment, you can use the following method:
//ensures that a given appointment is visible e.g. the view is changed if needed, if the view is grouped by resource,
//the appropriate resource is selected and if the view is dayview or weekview, the view is scrolled down to the appointment
SchedulerUIHelper.BringAppointmentIntoView(this.radScheduler1.Appointments[0], this.radScheduler1);

I hope this helps. Do not hesitate to write back in case you have any additional questions.

All the best,
Ivan Todorov
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Karl
Top achievements
Rank 1
answered on 06 Mar 2012, 12:56 PM
HI,

Thanks, that works. I'm having one other problem though. When I got to use this code:
SchedulerUIHelper.BringAppointmentIntoView(this.radScheduler1.Appointments[rs.Appointments.Count - 1], this.radScheduler1);

It scolls to the last appointment in the view, however it does not display the the appointments them self.
I've put this line after the

rs.DataSource = dataSource;



Thanks

0
Ivan Todorov
Telerik team
answered on 08 Mar 2012, 05:11 PM
Hi Karl,

I am not sure I fully understand the nature of the problem. In case you mean that after calling the BringAppointmentIntoView method you need to do additional vertical scrolling to see the appointment, this might be due to the behavior of the layout system. To work correctly, the BringAppointmentIntoView method requires that RadScheduler's layout is in a valid state. However, the layout of the controls on a form is not updated while it is being constructed. This means that you shouldn't call the BringAppointmentIntoView method from the form's constructor but from its Shown or Load events instead:
    public Form1()
    {
        InitializeComponent();
        radScheduler1.DataSource = ds;
    }
 
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        SchedulerUIHelper.BringAppointmentIntoView(radScheduler1.Appointments[0], radScheduler1);
    }
}

In case this is not the problem you are describing, I would kindly ask you to open a new support ticket and send us a sample project that demonstrates your approach. I am asking you this since there might be some specific code in your project that is either not correct or it triggers an issue in RadScheduler. Being able to replicate your scenario locally will let me investigate what is causing the problem and provide you with more concrete answer.

Do let me know if you continue to experience difficulties.

All the best,
Ivan Todorov
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Pramod
Top achievements
Rank 1
answered on 02 Dec 2015, 11:58 AM

Hi..

Yes, it is working for me in DayView / WeekView but when comes to "radScheduler.GroupType = GroupType.Resource;" am using following two approaches, which both are not working.

Approache: 1

((SchedulerDayViewGroupedByResourceElement)schedulerResourceView.SchedulerElement.ViewElement).GetDayViewElements().FirstOrDefault().DataAreaElement.Table.ScrollToTime(DateTime.Now.TimeOfDay);

Approache: 2

((SchedulerDayViewGroupedByResourceElement)schedulerResourceView.SchedulerElement.ViewElement).ScrollToTime(DateTime.Now.TimeOfDay); 

Please help me.

Thanks

Pramod

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 04 Dec 2015, 12:13 PM
Hello Pramod,

Thank you for writing.

Please refer to the following code snippet demonstrating how to scroll to a specific time when RadScheduler is grouped by resources: 
public Form1()
{
    InitializeComponent();
 
    this.radScheduler1.ActiveViewType = SchedulerViewType.Day;
    Color[] colors = new Color[]
    {
        Color.LightBlue, Color.LightGreen, Color.LightYellow,
        Color.Red, Color.Orange, Color.Pink, Color.Purple, Color.Peru, Color.PowderBlue
    };
 
    string[] names = new string[]
    {
        "Alan Smith", "Anne Dodsworth",
        "Boyan Mastoni", "Richard Duncan", "Maria Shnaider"
    };
 
    for (int i = 0; i < names.Length; i++)
    {
        Resource resource = new Resource();
        resource.Id = new EventId(i);
        resource.Name = names[i];
        resource.Color = colors[i];
        this.radScheduler1.Resources.Add(resource);
    }
    this.radScheduler1.GroupType = GroupType.Resource;
 
    SchedulerDayViewBase view = this.radScheduler1.SchedulerElement.View as SchedulerDayViewBase;
    view.RangeFactor = ScaleRange.QuarterHour;
   
}
 
protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);
    SchedulerDayViewGroupedByResourceElement mainElement = this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewGroupedByResourceElement;
              
    foreach (RadElement el in mainElement.Children)
    {
        SchedulerDayViewElement dayView = el as SchedulerDayViewElement;
        if (dayView != null)
        {
            dayView.DataAreaElement.Table.ScrollToTime(new TimeSpan(16, 0, 0));
            
        }
    }
}

I hope this information helps. Should you have further questions I would be glad to help.
 
Regards,
Dess
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Pramod
Top achievements
Rank 1
answered on 11 Dec 2015, 11:32 AM
Hi Dess,

Thanks for replay.

It is working when form loading for the first time.
But below is the main problem
Ex : I have a datetime control, when I change the date the Scheduler control will reload with appointments, but the scroll bar not set to specified time

Thanks
Pramod
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 11 Dec 2015, 01:44 PM
Hello Pramod,

Thank you for writing back.

I have modified my sample project to include a RadDateTimePicker as well. When the value in the RadDateTimePicker is changed, I change the RadScheduler.FocusedDate property. However, the vertical scrollbar keeps its state. Even though I scroll to another time, it behaves as expected. Here is my sample code snippet which result is illustrated on the attached gif file:
public Form1()
{
    InitializeComponent();
 
    this.radScheduler1.ActiveViewType = SchedulerViewType.Day;
    Color[] colors = new Color[]
    {
        Color.LightBlue, Color.LightGreen, Color.LightYellow,
        Color.Red, Color.Orange, Color.Pink, Color.Purple, Color.Peru, Color.PowderBlue
    };
 
    string[] names = new string[]
    {
        "Alan Smith", "Anne Dodsworth",
        "Boyan Mastoni", "Richard Duncan", "Maria Shnaider"
    };
 
    for (int i = 0; i < names.Length; i++)
    {
        Resource resource = new Resource();
        resource.Id = new EventId(i);
        resource.Name = names[i];
        resource.Color = colors[i];
        this.radScheduler1.Resources.Add(resource);
    }
    this.radScheduler1.GroupType = GroupType.Resource;
 
    SchedulerDayViewBase view = this.radScheduler1.SchedulerElement.View as SchedulerDayViewBase;
    view.RangeFactor = ScaleRange.QuarterHour;
   
}
 
protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);
    SchedulerDayViewGroupedByResourceElement mainElement = this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewGroupedByResourceElement;
              
    foreach (RadElement el in mainElement.Children)
    {
        SchedulerDayViewElement dayView = el as SchedulerDayViewElement;
        if (dayView != null)
        {
            dayView.DataAreaElement.Table.ScrollToTime(new TimeSpan(11, 0, 0));
            
        }
    }
}
 
private void radDateTimePicker1_ValueChanged(object sender, EventArgs e)
{
    this.radScheduler1.FocusedDate = this.radDateTimePicker1.Value;
    SchedulerDayViewGroupedByResourceElement mainElement = this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewGroupedByResourceElement;
 
    foreach (RadElement el in mainElement.Children)
    {
        SchedulerDayViewElement dayView = el as SchedulerDayViewElement;
        if (dayView != null)
        {
            dayView.DataAreaElement.Table.ScrollToTime(new TimeSpan(20, 0, 0));
 
        }
    }
}

Am I missing something? Could you please specify the exact steps how to reproduce the problem or get back to me with a sample code snippet reproducing the problem? Thank you ina advance.

I am looking forward to your reply.

Regards,
Dess
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Pramod
Top achievements
Rank 1
answered on 17 Dec 2015, 12:45 PM

Hi Dess,

Thank you for replay.
It is working for one Resource with "DayCount  = 3", if we change the "DayCount = 1", it is not working.
Please look into following code.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Telerik.WinControls;
using Telerik.WinControls.UI;
 
namespace SchedulerGroupResourceExample
{
    public partial class RadForm1 : Telerik.WinControls.UI.RadForm
    {
        public RadForm1()
        {
            InitializeComponent();
            this.radScheduler1.ActiveViewType = SchedulerViewType.Day;
            Color[] colors = new Color[]    {
        Color.LightBlue, Color.LightGreen, Color.LightYellow,
        Color.Red, Color.Orange, Color.Pink, Color.Purple, Color.Peru, Color.PowderBlue};
 
            string[] names = new string[]
            {
                "Alan Smith"
                //,         "Anne Dodsworth",
                //"Boyan Mastoni", "Richard Duncan", "Maria Shnaider"
            };
 
            for (int i = 0; i < names.Length; i++)
            {
                Resource resource = new Resource();
                resource.Id = new EventId(i);
                resource.Name = names[i];
                resource.Color = colors[i];
                this.radScheduler1.Resources.Add(resource);
            }
 
            this.radScheduler1.GroupType = GroupType.Resource;
 
 
 
            SchedulerDayViewBase view = this.radScheduler1.SchedulerElement.View as SchedulerDayViewBase;
 
            view.RangeFactor = ScaleRange.QuarterHour;
 
 
 
        }
 
 
 
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
 
            SchedulerDayViewGroupedByResourceElement mainElement = this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewGroupedByResourceElement;
            mainElement.ScrollToTime(DateTime.Now.TimeOfDay);
            //foreach (RadElement el in mainElement.Children)
            //{
            //    SchedulerDayViewElement dayView = el as SchedulerDayViewElement;
 
            //    if (dayView != null)
            //    {
 
            //        dayView.DataAreaElement.Table.ScrollToTime(DateTime.Now.TimeOfDay);
 
 
 
            //    }
            //}
        }
 
        private void radDateTimePicker1_ValueChanged(object sender, EventArgs e)
        {
 
            this.radScheduler1.FocusedDate = this.radDateTimePicker1.Value;
 
            SchedulerDayViewGroupedByResourceElement mainElement = this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewGroupedByResourceElement;
 
            SchedulerDayView dayView1 = this.radScheduler1.GetDayView();
            dayView1.DayCount = 1;
 
            mainElement.ScrollToTime(DateTime.Now.TimeOfDay);
            //foreach (RadElement el in mainElement.Children)
            //{
 
            //    SchedulerDayViewElement dayView = el as SchedulerDayViewElement;
 
            //    if (dayView != null)
            //    {
            //        dayView.DataAreaElement.Table.ScrollToTime(DateTime.Now.TimeOfDay);
            //    }
 
            //}
 
        }
    }
}

Note : We can use following code also instead of "Foreach" to set "ScrollToTime"

SchedulerDayViewGroupedByResourceElement mainElement = this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewGroupedByResourceElement;
mainElement.ScrollToTime(DateTime.Now.TimeOfDay);

Thanks
Pramod Boora

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 17 Dec 2015, 02:45 PM
Hello Pramod,

Thank you for writing back.

Following the provided information, I was unable to reproduce the issue you are facing. When I set the DayCount property to 1, the ScrollToTime method works as expected on my end. I have attached my sample project. Could you please specify the exact steps how to reproduce the problem or what changes I should perform in order to reproduce the experienced issue? Thank you in advance. 

I am looking forward to your reply.

Regards,
Dess
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Pramod
Top achievements
Rank 1
answered on 17 Dec 2015, 03:12 PM
Hi Dess

Thank you for replay.

Please change your code as shown in the screen cap and try to change the value of DateTimePicker.

Thanks
Pramod
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 18 Dec 2015, 01:45 PM
Hello Pramod,

Thank you for writing back.

When I perform the illustrated code change, I am still unable to replicate the problem you are facing. Please have a look at the attached gif file illustrating the behavior on my end with the latest version (2015.3.1104.40). Could you please confirm whether you are using this version?

Alternatively, feel free to open a support thread where you can provide a sample project replicating the undesired behavior. Thus, we would be able to investigate the precise case and assist you further. Thank you in advance.

I am looking forward to your reply.

 Regards,
Dess
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Pramod
Top achievements
Rank 1
answered on 28 Dec 2015, 02:25 PM

Hi Dess,

Thank you for reply
In my scenario the initial resources per view will be "3" and then when I change to "1" it doesn't scroll to current time.
I tried the same using your code and I am able to reproduce and my version is "2012.2.726.40"

Following is my code

namespace _516016_SchedulerScrollToTime
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
 
            this.radScheduler1.ActiveViewType = SchedulerViewType.Day;
            this.radScheduler1.GetDayView().DayCount = 1;
            Color[] colors = new Color[]
            {
                Color.LightBlue, Color.LightGreen, Color.LightYellow,
                Color.Red, Color.Orange, Color.Pink, Color.Purple, Color.Peru, Color.PowderBlue
            };
 
            string[] names = new string[]
            {
                "Alan Smith", "Anne Dodsworth",
                "Boyan Mastoni", "Richard Duncan", "Maria Shnaider"
            };
 
            for (int i = 0; i < names.Length; i++)
            {
                Resource resource = new Resource();
                resource.Id = new EventId(i);
                resource.Name = names[i];
                resource.Color = colors[i];
                this.radScheduler1.Resources.Add(resource);
            }
            this.radScheduler1.GroupType = GroupType.Resource;
 
            this.radScheduler1.ActiveView.ResourcesPerView = 3; //My code change
 
            SchedulerDayViewBase view = this.radScheduler1.SchedulerElement.View as SchedulerDayViewBase;
            view.RangeFactor = ScaleRange.QuarterHour;
           
        }
 
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            SchedulerDayViewGroupedByResourceElement mainElement = this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewGroupedByResourceElement;
                      
            foreach (RadElement el in mainElement.Children)
            {
                mainElement.ScrollToTime(DateTime.Now.TimeOfDay);
            }
        }
 
        private void radDateTimePicker1_ValueChanged(object sender, EventArgs e)
        {
            this.radScheduler1.FocusedDate = this.radDateTimePicker1.Value;
            SchedulerDayViewGroupedByResourceElement mainElement = this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewGroupedByResourceElement;
 
            this.radScheduler1.ActiveView.ResourcesPerView = 1; //My code change
 
            foreach (RadElement el in mainElement.Children)
            {
                SchedulerDayViewElement dayView = el as SchedulerDayViewElement;
                if (dayView != null)
                {
                    dayView.DataAreaElement.Table.ScrollToTime(new TimeSpan(18, 0, 0));
 
                }
            }
        }
    }
}

Thanks
Pramod

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 28 Dec 2015, 03:24 PM
Hello Pramod,

Thank you for writing back.

I was able to replicate the undesired behavior in the specified 2012.2.726.40 version. We had a known issue related to this problem which was addressed in Q2 2014. Here is the feedback item for your reference: http://feedback.telerik.com/Project/154/Feedback/Details/111720-fix-radscheduler-scrolltotime-and-scrolltoworkhours-not-working-properly
Unfortunately, due to the specificity of RadScheduler, I can not provide you with a workaround for this version. 

I would like to note that in Q2 2014 we introduced an improved RadScheduler where all of the known disadvantages of the previous control version were addressed and new features were implemented. You can refer to the release history for more detailed information: http://www.telerik.com/support/whats-new/winforms/release-history/ui-for-winforms-q2-2014

It is recommended to upgrade to at least this version in order to benefit from the introduced improvements.

I hope this information helps. If you have any additional questions, please let me know.

Regards,
Dess
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Pramod
Top achievements
Rank 1
answered on 27 Jan 2016, 01:32 PM

Hi Dess,

Thanks you for writing back
I have updated my project Telerik version 2012.2.726 to 2014.2.617 (Q2 2014),
I got lot of issue and I have fixed.

But I have a project, which I got from Telerik website regarding MulriSelectionDropDownList, below is link
"http://www.telerik.com/support/kb/winforms/dropdown-checkeddropdown-and-list/details/multi-select-drop-down-list".
When I update this project from 2012.2.726 to 2014.2.617, it is not working.

Please help me on this

Thanks
Pamod

0
Pramod
Top achievements
Rank 1
answered on 27 Jan 2016, 04:11 PM

Hi Dess,

 Issue with this URL

http://www.telerik.com/support/code-library/radmultiselectdropdownlist#MhLw6s5gUUaxCyjvC1oRCQ

Please ignore above(previous post) url

 

Thanks,

Pramod

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 28 Jan 2016, 09:45 AM
Hello Pramod,

Thank you for writing back. 

We will take a look at the referred Code Library article if it is applicable for newer versions.

Feel free to use RadCheckedDropDownList which provides functionality to check items in the drop down area and them in the text area. The control was introduced in Q3 2014. Additional information for the control can be found at the following link: http://docs.telerik.com/devtools/winforms/dropdown,-listcontrol-and-checkeddropdownlist/checkeddropdownlist/getting-started

I would kindly ask you to open a separate thread with the appropriate Product (e.g. RadDropDownList for WinForms) and to avoid mixing different subjects in the same thread in future. This will also give you the opportunity to track the different cases easily in your account. Thank you for your understanding.

I hope this information helps. If you have any additional questions, please let me know.

Regards,
Dess
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Victor
Top achievements
Rank 2
answered on 17 Nov 2016, 04:51 PM

Hello there,

 

This does not work in case the scheduler is in Timelineview. How can I resolve it in that case?

 

Kind regards

Victor

 

 

 

SchedulerDayViewElement dayViewElement = this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewElement;

if (dayViewElement != null)
{
    //scrolls dayview or weekview to the specified time slot
    dayViewElement.DataAreaElement.Table.ScrollToTime(new TimeSpan(DateTime.Now.Hour, 0, 0));
}

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 18 Nov 2016, 09:07 AM
Hello Victor,

Thank you for writing.  

In order to scroll to a specific time frame in Timeline view, you can set the RadScheduler.ActiveView.StartDate property specifying the time part as well.

I hope this information helps. Should you have further questions I would be glad to help.

Regards,
Dess
Telerik by Progress
Telerik UI for WinForms is ready for Visual Studio 2017 RC! Learn more.
Tags
Scheduler and Reminder
Asked by
Karl
Top achievements
Rank 1
Answers by
Ivan Todorov
Telerik team
Karl
Top achievements
Rank 1
Pramod
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Victor
Top achievements
Rank 2
Share this question
or