Hi, I am trying to recreate something similar to the WPF timeline sample using the Win Form ‘UltraTimelineView’ tool. I could not find a similar forms sample.
I am using a panel and picture box above the timeline and overlaying graphics and buttons on the panel/picture.
I am driving the viewable area in the panel using the start and end date/times from the ‘UltraTimelineView’. This way as the timeline viewport changes I will syncronise & display similar changes in the picture/panel view.
I get the dates/times from
TextBox1.Text = e.VisibleDateTimeRange.StartDateTime.ToLongDateString()
TextBox2.Text = e.VisibleDateTimeRange.StartDateTime.ToLongTimeString()
TextBox3.Text = e.VisibleDateTimeRange.EndDateTime.ToLongDateString()
TextBox4.Text = e.VisibleDateTimeRange.EndDateTime.ToLongTimeString()
in the UltraTimelineView1_VisibleDateTimeRangeChanged event.
This works fine if I use the buttons in the header bar to move the increment and decrement dates as it does if I use the left and right buttons on the horizontal scroll bar on the timeline. These move the timeline in solid one month intervals.
However when I drag the dates using the drag-able portion of the UltraTimelineView’ horizontal scroll bar visually the timeline may drop mid month but the dates returned by the 'e.VisibleDateTimeRange.EndDateTime.ToLongTimeString' shows beginning or end of month. Have tried using :-
Me.UltraTimelineView1.EnsureDateTimeVisible(e.VisibleDateTimeRange.StartDateTime.ToLongDateString()
with little success.
I am using the 11.2.20112.2028 version of the control which should be pretty up-to-date.
My first time using this control so have clearly missed something. Any advice/samples appreciated.
JPeg image enclosed
Phil
Hello Phil,
I`m not sure that I understand your scenario and what you are looking for, but I try to create a small sample. Could you please take a look at the attached sample and video file and let me know if you think that I miisunderstood your scenario or if you have any questions.
Regards
Thanks for the quick response that's a great example. I could not return the code as a zip as it exceeded limit.
If you add four text boxes,
Then add the code
TextBox1.Text = e.VisibleDateTimeRange.StartDateTime.ToLongDateString();TextBox2.Text = e.VisibleDateTimeRange.StartDateTime.ToLongTimeString();TextBox3.Text = e.VisibleDateTimeRange.EndDateTime.ToLongDateString();TextBox4.Text = e.VisibleDateTimeRange.EndDateTime.ToLongTimeString();
to the end of 'private void ultraTimelineView1_VisibleDateTimeRangeChanged'
and add the code to the form load to set the intervals & headers
DateInterval dayinterval = new DateInterval(1, DateIntervalUnits.Days);DateInterval monthinterval = new DateInterval(1, DateIntervalUnits.Months);DateInterval yearinterval = new DateInterval(1, DateIntervalUnits.Years);//Add year Header AdditionallyultraTimelineView1.AdditionalIntervals.Add(yearinterval);//Set column header orientation for yearyearinterval.HeaderTextOrientation = TextOrientationInfo.Horizontal45Degrees;//Set primary interval to monthsultraTimelineView1.PrimaryInterval = monthinterval;// Prevent the user from sizing rows directlyultraTimelineView1.OwnerSizing = Infragistics.Win.UltraWinSchedule.TimelineViewOwnerSizing.None;// Prevent the user from sizing columns directlyultraTimelineView1.ColumnSizing = Infragistics.Win.UltraWinSchedule.TimelineViewColumnSizing.None;//Column width other than ownerultraTimelineView1.ColumnWidth = 100;
What I am trying to achieve is to put events on the timeline and information corresponding to the events in the panel above. As I scroll the timeline I will scroll the panel by a similar amount making them appear a single entity.You have achieved this using the scrollbar which is great and I will need to study this as it may be the answer I need.Syncronising the two I thought could be done by determining the visible start and end dates in the timeline. With the additional code I display these for clarity in the four text boxes. When you click on the button controls controlling the movement of the timeline either in the header or on each end of the timeline scroll bar, the date increments in months and this is reflected in the text boxes. When you do this using the centre of the scroll bar you can drag and drop the date to the middle of a month and this is not reflected in the text boxes.This in turn prevents me from syncronising the timeline view to the information I will put in the panel view.I had tried ensure date visible but feel I need the equivalent of
' Get the next/previous date depending on the navigation direction.
Dim forward As Boolean = IIf(e.NavigationDirection = DateNavigationDirection.Forward, True, False)
nextDate = timeInterval.GetNextDate(nextDate, forward)
' Call EnsureDateTimeVisible to navigate to the date
control.EnsureDateTimeVisible(nextDate, forward = False)
But for the scroll bar.
I try to reproduce your scenario in my sample and I think that everything works properly. Could you please take a look at the latest modifications that I made in the sample and attached video. Let me know if you have any questions.
PS: Please do not hesitate to modify this sample to reprduce your issue and revert it back to me. I`ll be glad to research your issue.
Thanks again for the update. I have problems zipping your example up small enough to meet your limit so I have zipped up just my form. I only have an old version of winzip.
In your example you enter dates in the textbox to move the timeline. This was not what I was trying to describe. The new form should show that if you move the scroll bar using its central slider control of the scrollbar , the returned dates in Month view (not hour view which is probably the smallest increment) scroll less than a full month yet the return from the scroll event to the textboxes indicate it has scrolled full months which is untrue.
You may need to swap out the controls as I am using different versions.
Cheers
Thanks for provided code. I already upgrade my sample with your code and also made small change in the existing code to achieve desired behavior. I`m using CreationFilter to determinate which UIElement is Full visible.
In our first scenario we are using VisibaleDateTimeRage, but we didn`t check is it FullyVisible or not, that way we get the mentioned behavior.
Please take a look at the latest modifications in the sample and attached video for more details and let me know if you have any questions.
Thank you for your responses Georgi, what you have provided is a very effective solution and much better than the method I originall proposed to use.
Just a note, I enclose a Word document which should explain my original confusion.
Thanks for attached details about your confusion, but I`d like to inform you that mentioned behavior is expected and by design because:
1. Please refer the attached screenshot - each month has his own TimeSlotUIElement. In our code we check if this UIElement is fully visible. That`s way in the screenshot we have interval (01 June 2021 - 30 November 2021),because only these UIElements are fully visible (May and December UIElements are partialy visible)
2. Regarding your questions "In the left I scrolled the timeline to somewhere in the middle of May. The dates in the box show 01 June to 30 Nov is visible. Correct but not also is May 20-May 30. I then hit the lower right hand side arrow as shown with the mouse pointer on the right picture. The timeline flicked to the beginning of June and showed part of December but the dates and time in the text boxes remained the same. " As I already explain that, each month has just one UIElement which contains by one property like :
DateTimeRange.StartDateTime
DateTimeRange.EndDateTime
so at that moment you are not able to achieve expected behavior. To achieve desired behavior we should have different UIElement for each day in the month. If you change your Primary Interval to be DAY, you could have different UIElements per day and you will be able to achieve desired behavior, but this will change your look and feel.
Please let me know if you have any further questions.
Georgi