Scroll to time

19 posts, 0 answers
  1. Karl
    Karl avatar
    172 posts
    Member since:
    Jun 2009

    Posted 24 Feb 2012 Link to this post

    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
  2. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 29 Feb 2012 Link to this post

    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 >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Karl
    Karl avatar
    172 posts
    Member since:
    Jun 2009

    Posted 06 Mar 2012 Link to this post

    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

  5. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 08 Mar 2012 Link to this post

    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 >>
  6. Pramod
    Pramod avatar
    8 posts
    Member since:
    Dec 2015

    Posted 02 Dec 2015 in reply to Ivan Todorov Link to this post

    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

  7. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 04 Dec 2015 Link to this post

    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
  8. Pramod
    Pramod avatar
    8 posts
    Member since:
    Dec 2015

    Posted 11 Dec 2015 in reply to Dess Link to this post

    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
  9. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 11 Dec 2015 Link to this post

    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
  10. Pramod
    Pramod avatar
    8 posts
    Member since:
    Dec 2015

    Posted 17 Dec 2015 in reply to Dess Link to this post

    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

  11. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 17 Dec 2015 Link to this post

    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
  12. Pramod
    Pramod avatar
    8 posts
    Member since:
    Dec 2015

    Posted 17 Dec 2015 in reply to Dess Link to this post

    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
  13. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 18 Dec 2015 Link to this post

    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
  14. Pramod
    Pramod avatar
    8 posts
    Member since:
    Dec 2015

    Posted 28 Dec 2015 in reply to Dess Link to this post

    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

  15. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 28 Dec 2015 Link to this post

    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
  16. Pramod
    Pramod avatar
    8 posts
    Member since:
    Dec 2015

    Posted 27 Jan in reply to Dess Link to this post

    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

  17. Pramod
    Pramod avatar
    8 posts
    Member since:
    Dec 2015

    Posted 27 Jan in reply to Pramod Link to this post

    Hi Dess,

     Issue with this URL

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

    Please ignore above(previous post) url

     

    Thanks,

    Pramod

  18. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 28 Jan Link to this post

    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 tokenize 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
  19. Victor
    Victor avatar
    11 posts
    Member since:
    Aug 2016

    Posted 17 Nov in reply to Ivan Todorov Link to this post

    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));
    }

  20. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 18 Nov Link to this post

    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.
Back to Top
UI for WinForms is Visual Studio 2017 Ready