Scheduler scroller, when resizing appointment

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

    Posted 05 Apr 2012 Link to this post

    Hi,

    I have a scheduler which displays a single day, when I add an appoinment and resize it out side the view of the scheduler the scroll bar does not move with the resizing of the appointment. I would like to achive the same as the outlool calendar.

    This is the scheduler in my app:
    http://screencast.com/t/gaDDR5TWqx

    This is out look
    http://screencast.com/t/zYgGuzwu1y

    Is this possible?

    Thanks
  2. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 09 Apr 2012 Link to this post

    Hello Karl,

    Thank you for contacting us.

    Yes, it is possible to achieve this. In order to do so, you need to handle the MouseMove event of RadScheduler as it is shown below:
    private void radScheduler1_MouseMove(object sender, MouseEventArgs e)
    {
        SchedulerDayViewElement viewElement = (this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewElement);
         
        if (viewElement == null)
            return;
     
        DayViewAppointmentsTable table = viewElement.DataAreaElement.Table;
     
        if (this.radScheduler1.SchedulerElement.ResizeBehavior.IsResizing &&
            e.Y > this.radScheduler1.Height)
        {
            table.Scroll(false);
        }
        else if (this.radScheduler1.SchedulerElement.ResizeBehavior.IsResizing &&
            e.Y < viewElement.AllDayHeaderElement.ControlBoundingRectangle.Bottom)
        {
            table.Scroll(true);
        }
    }

    As supporting such functionality out of the box seems very reasonable, I have logged this as a feature request in our Public Issue Tracking System. Here you can find the PITS entry. Your Telerik points have been updated for this request.

    Do not hesitate to contact us whenever you have any future questions regarding our products.

    Kind regards,
    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 11 Apr 2012 Link to this post

    Thanks
  5. Peter
    Peter avatar
    16 posts
    Member since:
    Apr 2012

    Posted 18 Sep 2012 Link to this post

    Hello Ivan,

    I have a Scheduler in week or dayview and I want to add an appointment by selecting the time for it. When I reach an area out side the view of the scheduler the scroll bar does not move with the selection. I would like to achieve a similiar behaviour as with the resizing of the appointment shown above. 

    I've found such behaviour for example in the google calender. 

    Could you provide me a short code snipped? 

    Thank you in advance,

    Peter 
  6. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 21 Sep 2012 Link to this post

    Hi Peter,

    This functionality can be achieved using a similar approach. The following code snippet demonstrates this:
    public Form1()
    {
        InitializeComponent();
        this.radScheduler1.MouseMove += new MouseEventHandler(radScheduler1_MouseMove);
        this.radScheduler1.MouseDown += new MouseEventHandler(radScheduler1_MouseDown);
        this.radScheduler1.MouseUp += new MouseEventHandler(radScheduler1_MouseUp);
    }
     
    void radScheduler1_MouseUp(object sender, MouseEventArgs e)
    {
        this.radScheduler1.Capture = false;
    }
     
    void radScheduler1_MouseDown(object sender, MouseEventArgs e)
    {
        if (this.radScheduler1.ElementTree.GetElementAtPoint(e.Location) is SchedulerCellElement)
        {
            this.radScheduler1.Capture = true;
        }
    }
     
    void radScheduler1_MouseMove(object sender, MouseEventArgs e)
    {
        if (this.radScheduler1.DragDropBehavior.IsDragging || e.Button != System.Windows.Forms.MouseButtons.Left)
        {
            return;
        }
     
        DayViewAppointmentsArea appointmentArea = (this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewElement).DataAreaElement;
        Rectangle tableRectangle = appointmentArea.ControlBoundingRectangle;
     
        if (!tableRectangle.Contains(e.Location))
        {
            if (e.Y > tableRectangle.Bottom)
            {
                appointmentArea.Table.Scroll(false);
            }
            else if (e.Y < tableRectangle.Top)
            {
                appointmentArea.Table.Scroll(true);
            }
        }
    }

    I hope you find this useful. Feel free to ask if you have additional questions.

    All the best,
    Ivan Todorov
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
  7. Peter
    Peter avatar
    16 posts
    Member since:
    Apr 2012

    Posted 27 Sep 2012 Link to this post

    Hi Ivan,

    thank you very much for the solution. It works fine for me. A short remark: I can't use

    this.radScheduler1.DragDropBehavior

    in Telerik WinForms v. 2012.2.912.40 because there is no such method. 

    Best regards,

    Peter
  8. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 27 Sep 2012 Link to this post

    Hi Peter,

    Yes, in the version you are using you should access the DragDropBehavior as shown below:
    this.radScheduler1.SchedulerElement.DragDropBehavior

    As of the next official release, the DragDropBehavior will be available directly on the control.

    Feel free to ask if you have any additional questions.

    Kind regards,
    Ivan Todorov
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Back to Top
UI for WinForms is Visual Studio 2017 Ready