TimerRuler value

4 posts, 0 answers
  1. Christie Admin
    Christie Admin avatar
    239 posts
    Member since:
    Aug 2013

    Posted 12 Jun 2014 Link to this post

    Hi,

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

    Thank's
    Alain
  2. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 13 Jun 2014 Link to this post

    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.
     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Christie Admin
    Christie Admin avatar
    239 posts
    Member since:
    Aug 2013

    Posted 17 Jun 2014 Link to this post

    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
  5. Kalin
    Admin
    Kalin avatar
    1208 posts

    Posted 20 Jun 2014 Link to this post

    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.
     
Back to Top