This is a migrated thread and some comments may be shown as answers.
TimelineViewDefinition DayStartTime DayEndTime ArgumentException
13 Answers 127 Views
This is a migrated thread and some comments may be shown as answers.
Olivier
Top achievements
Rank 1
Olivier asked on 12 May 2011, 08:30 PM
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?

13 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 13 May 2011, 08:15 AM
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
0
Olivier
Top achievements
Rank 1
answered on 13 May 2011, 04:23 PM
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!

0
Yana
Telerik team
answered on 16 May 2011, 02:23 PM
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
0
Eric Meehan
Top achievements
Rank 1
answered on 01 Sep 2011, 09:15 PM
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.
0
Yana
Telerik team
answered on 02 Sep 2011, 02:01 PM
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 >>

0
Vonziz
Top achievements
Rank 1
answered on 02 Feb 2012, 12:54 PM
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.

0
Eric Meehan
Top achievements
Rank 1
answered on 02 Feb 2012, 04:16 PM
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);
        }
0
Vonziz
Top achievements
Rank 1
answered on 02 Feb 2012, 04:32 PM
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. :-)
0
Eric Meehan
Top achievements
Rank 1
answered on 02 Feb 2012, 05:30 PM
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 :)
0
Vonziz
Top achievements
Rank 1
answered on 03 Feb 2012, 05:10 PM
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.


0
Vonziz
Top achievements
Rank 1
answered on 03 Feb 2012, 06:13 PM
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?
0
Eric Meehan
Top achievements
Rank 1
answered on 03 Feb 2012, 09:09 PM
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 :)
0
Vonziz
Top achievements
Rank 1
answered on 04 Feb 2012, 01:08 PM
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.
Asked by
Olivier
Top achievements
Rank 1
Answers by
Yana
Telerik team
Olivier
Top achievements
Rank 1
Eric Meehan
Top achievements
Rank 1
Vonziz
Top achievements
Rank 1
Share this question
or