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

TimerRuler value

3 Answers 80 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Christie Admin
Top achievements
Rank 1
Christie Admin asked on 12 Jun 2014, 01:10 PM
Hi,

after using the ScrollTimeRuler function, is it possible to get the value of the TimeRuler for future reference???

Thank's
Alain

3 Answers, 1 is accepted

Sort by
0
Konstantina
Telerik team
answered on 13 Jun 2014, 02:01 PM
Hi Alain,

After scrolling you could check the FirstVisibleTime property of the ScheduleView, which will show you the time at the top of the control.

Hope this helps.

Regards,
Konstantina
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Christie Admin
Top achievements
Rank 1
answered on 17 Jun 2014, 01:27 PM
Hi Konstantina,

When I start my application, the FirstVisibleTime is 8:00AM, if I scroll down, the FirstVisibleTime become 8:15AM then if I scroll up, the FirstVsibleTime become 8:00PM... Can you explain that ???

here is the piece of code I have in my usercontrol:

this.ScheduleView.AddHandler(RadScheduleView.PreviewMouseWheelEvent, new MouseWheelEventHandler(ScheduleView_OnMouseWheel), true);

private void ScheduleView_OnMouseWheel(object sender, MouseWheelEventArgs e)
{                                
    if (e.Delta > 0) // Up
    {
        this.ScheduleView.ScrollTimeRuler(this.ScheduleView.FirstVisibleTime.Subtract(TimeSpan.FromMinutes(15)), true, true);
    }
    else // Down
    {
        this.ScheduleView.ScrollTimeRuler(this.ScheduleView.FirstVisibleTime.Add(TimeSpan.FromMinutes(15)), true, true);
    }

    e.Handled = true;
}

Thank's
Alain
0
Kalin
Telerik team
answered on 20 Jun 2014, 08:37 AM
Hello Alain,

The reason for the explained behavior is in the ScrollViewed going on the bottom again when scrolled to value less than the DayStartTime. What I can suggest you would be to simply check if there is enough space to scroll up and if not to set the FirstVisibleTime to be equal to the DayStartTime of the current ActiveViewDefinition. The exact approach is demonstrated in the following code snippet:

private void ScheduleView_OnMouseWheel(object sender, MouseWheelEventArgs e)
{
    if (e.Delta > 0) // Up
    {
        if (this.ScheduleView.FirstVisibleTime >= this.ScheduleView.ActiveViewDefinition.DayStartTime + TimeSpan.FromMinutes(15))
        {
            this.ScheduleView.ScrollTimeRuler(this.ScheduleView.FirstVisibleTime.Subtract(TimeSpan.FromMinutes(15)), true, true);
        }
        else
        {
            this.ScheduleView.FirstVisibleTime = this.ScheduleView.ActiveViewDefinition.DayStartTime;
        }
    }
    else // Down
    {
        this.ScheduleView.ScrollTimeRuler(this.ScheduleView.FirstVisibleTime.Add(TimeSpan.FromMinutes(15)), true, true);
    }
 
    e.Handled = true;
}

Hope this helps.

Regards,
Kalin
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
ScheduleView
Asked by
Christie Admin
Top achievements
Rank 1
Answers by
Konstantina
Telerik team
Christie Admin
Top achievements
Rank 1
Kalin
Telerik team
Share this question
or