TimelineViewDefinition DayStartTime DayEndTime ArgumentException

14 posts, 0 answers
  1. Olivier
    Olivier avatar
    8 posts
    Member since:
    Dec 2010

    Posted 12 May 2011 Link to this post

    I have a RadScheduleView set with a timelineViewDefinition. I'm trying to set the DayStartTime and DayEndTime to a specific Range (11:00 to 22:00) and I always encounter a ArgumentException when loading the control (even at design time).

                <telerik:RadScheduleView.ViewDefinitions>
                    <telerik:TimelineViewDefinition VisibleDays="1" StretchGroupHeaders="True" DayStartTime="11:00" DayEndTime="23:00" />
                </telerik:RadScheduleView.ViewDefinitions>

    But if I change it to (11:00 to 23:00) everything works fine : /


     Is this a bug from the control?
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 13 May 2011 Link to this post

    Hi Olivier,

    I've  tried to reproduce this error in a simple project but to no avail. Could you please give us more details about your scenario? Also can you confirm that you're using the latest release of RadControls (Q1 SP1)?

    Best wishes,
    Yana
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Olivier
    Olivier avatar
    8 posts
    Member since:
    Dec 2010

    Posted 13 May 2011 Link to this post

    Hello,

    I strongly believe that this issue is on your side as I can reproduce this every single time. The steps to reproduce are these:

    - Set a  RadScheduleView with a TimelineViewDefinition (I think any Viewdefinition that set the ScheduleView in Horizontal Mode will have the problem).
    - Set the VisibleDays of the TimelineViewDefinition to 1d.
    - Set a DayStartTime and DayEndTime where the duration is higher than the DayStartTime:
    ex: Start=11:00 End=16:00 so Duration=5h

    I've used .Net reflector to pin point the error:

    Class: TimeRulerPanel, Method: ArrangeTimeRulerGroupItem(UIElement child, Rect arrangeRect, bool isHorizontal)

    Error line:
    arrangeRect.set_Width((double) (tickData.Duration.Subtract(tickData.DateTime.get_TimeOfDay()).get_Ticks() / this.ScheduleView.EffectiveTicksPerPixel));


    So for the example values, it's substracting the DayStartTime from the Duration (5 - 11 = -6) then converts that in pixels and setting the "arrangeRect" width to a minus pixels value which cause a ArgumentException.

    Cheers!

  5. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 16 May 2011 Link to this post

    Hello Olivier,

    Thank you for the detailed explanation, we were able to reproduce the issue. I've logged it in our public issue tracking system, you can vote for it and track its progress here.

    I've updated your points for your involvement.

    All the best,
    Yana
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  6. Eric Meehan
    Eric Meehan avatar
    6 posts
    Member since:
    Jun 2010

    Posted 01 Sep 2011 Link to this post

    Is there a solution to this issue? I believe I am hitting it as well. Even if it is just a work-around, I would really appreciate some help.

    Thanks.
  7. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 02 Sep 2011 Link to this post

    Hi Eric,

    I'm afraid that there is no easy workaround that I can suggest.  We found that fixing this issue is more complicated than initially expected, that's why it's still in progress.

    We're sorry for the inconvenience.

    Kind regards,
    Yana
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  8. Vonziz
    Vonziz avatar
    17 posts
    Member since:
    Sep 2011

    Posted 02 Feb 2012 Link to this post

    Hi Yana,

    I've got the same critical problem like Eric and Olivier.
    Is this problem fixed today?
    Or a workaround exists ?

    This a big problem for my SL devlopements today and to choose to use your components suites.

    Thanks for your response.

  9. Eric Meehan
    Eric Meehan avatar
    6 posts
    Member since:
    Jun 2010

    Posted 02 Feb 2012 Link to this post

    Vonziz,

    I created my own method in a class that inherits from the RadScheduleView to deal with this issue. So far I'm yet to hear of the bug being triggered in the field. Pretty much it just makes the RadScheduleView bigger to avoid the bug. I hope this helps you :)


    public void SetTimeLineStartStop(TimelineViewDefinition timeline, DateTime start, DateTime stop)
            {
                TimeSpan dayStartTime = start - start.Date;
                TimeSpan duration = stop - start;


                //if duration < dayStartTime it triggers an annoying Telerik bug...
                //so here we work around that issue.
                if (duration < dayStartTime)
                {
                    long ticksToAdd = (dayStartTime - duration).Ticks / 2;

                    start -= TimeSpan.FromTicks(ticksToAdd);
                    stop += TimeSpan.FromTicks(ticksToAdd);

                    //ReCalculate the duration
                    duration = stop - start;
                }


                this.CurrentDate = start;


                timeline.DayStartTime = TimeSpan.FromHours(start.Hour);
                timeline.DayEndTime = TimeSpan.FromHours(stop.Hour + 1);


                timeline.VisibleDays = (int)Math.Ceiling(duration.TotalDays);
            }
  10. Vonziz
    Vonziz avatar
    17 posts
    Member since:
    Sep 2011

    Posted 02 Feb 2012 Link to this post

    Hi Eric,

    Thank you very much for your response.

    I would try your workaround but I'm using the RadScheduleView with the DayViewDefinition and the WeekViewDefinition.

    I'm afraid that your SetTimeLineStartStop method doesn't solve the problem for these two views.
    Do you know the method names to overide for DayViewDefinition and WeekViewDefinition ?

    I'm not an expert of Telerik's sources code components. :-)
  11. Eric Meehan
    Eric Meehan avatar
    6 posts
    Member since:
    Jun 2010

    Posted 02 Feb 2012 Link to this post

    Hey Vonziz,

    I'm no expert either but I think the members are the same--they're all inherited from ViewDefinitionBase. So, you can just change the TimeLineViewDefinition to ViewDefinitionBase and it should just work. Granted, I've only used this routine to solve my problem with the TimeLineViewDefinition, but it's very likely to fix the issue with any other view defintion.

    Hope it helps :)
  12. Vonziz
    Vonziz avatar
    17 posts
    Member since:
    Sep 2011

    Posted 03 Feb 2012 Link to this post

    Hey Eric,

    I've tried to replace TimeLineViewDefinition by ViewDefinitionBase and it doesn't work. :'(
    My own method is never called with these two views.

    But I really understand one thing in your workaround : do you call explicitly your SetTimeLineStartStop method? 
    Or you just add your own component and all is done automatically?

    Thanks for your reponse.


  13. Vonziz
    Vonziz avatar
    17 posts
    Member since:
    Sep 2011

    Posted 03 Feb 2012 Link to this post

    Ok Eric, excuse me.
    I didn't understand how your workaround works.
    That's OK now.

    The problem : I've used your method and everything is OK for execution.
    But I don't understand how your method works.

    Values that are calculated are totally different of values that I want to set. 
    So finally, my scheduleview have got dates interval totally wrong.

    For example, when I want to set 8:00 to 10:00, with your method, I've got 5:00 to 14:00 in result.

    Can you help me?
  14. Eric Meehan
    Eric Meehan avatar
    6 posts
    Member since:
    Jun 2010

    Posted 03 Feb 2012 Link to this post

    Hey Vonziz,

    The error occurs when the duration is less than the day start time. This code ensures that the duration is never less than the day start time. It could probably be tightened up some, but it was sufficient for my purposes and I thought it might help you too. If not then no hard feelings :)
  15. Vonziz
    Vonziz avatar
    17 posts
    Member since:
    Sep 2011

    Posted 04 Feb 2012 Link to this post

    Thanks Eric. After some tests, I've understood what you want to do in your method. But it doesn't correspond to my needs. I've found that this bug only occurs when the view orientation is set to horizontal. With a vertical orientation, all is fine. On Q3 version of Telerik components, this bug seems to be fixed.
Back to Top
DevCraft banner