I've used this wonderful tutorial/sample to be able to show baselines for my tasks. Everything works as expected, and I am able to produce a nice representation of both my current timelines as well as my baselines. The problem I do run into is when I select any of the baseline representations. When I do, I get this unhandled exception:
For what it's worth, I have disabled all drag actions as they are not necessary for this project. I don't even need the ability to select a task by clicking on the timeline; however, I have not been able to identify a method for disabling this nor handling the error before it reaches an unhandled exception.
Would someone be able to provide me with a method of either disabling this or handling the error?
For another very minor question - is there a way I can force the rectangle for the baseline to go behind the task that the baseline is defined for? I'm assuming its a draw order, but honestly graphics are not my strong suit and I'm struggling with this.
Thanks!
Sorry I forgot to include the link to the sample I used...
http://es.infragistics.com/community/forums/t/63942.aspx
Another thing... when I have a baseline bar that starts or finishes beyond the timeline bar for that task, I can no longer calculate it's position. Is there a way I can find the X position based on the timeline's timeslots and then Y position from the task's position in the grid?
OK - I got the answer to my last question, so I just thought I would share.
Understandably, there does not exist a TaskUIElement for items that have no visual representation in the Timeline section of the Gantt. Rather than look for the TaskUIElement, I grabbed the TaskAreaUIElement. Once acquired, I reviewed all the RowUIElements in the Ultragrid section of the Ultraganttview, and added a TaskUIElement for those with Baselines. I referenced the TimeSlotUIElement to position in the X and the RowUIElement to position in the Y. This approach is working very smoothly.
I'm still struggling with handling the click event of a task.
Hi
I have two questions in that.
subTask1.TaskSettings.Enabled =DefaultableBoolean.False;
1) Above code works well, but I'm not able to add color and drag operation for that subTask Timebar( I just want to avoid the error which I was getting in Click event of subTask)
2) I am not able drag and drop in Chart Area Part except Timebar. It because I want to create New task in the TimeLine Chart Area Portion. I'm using Mouse_Down,Up and Move event to get the date rang, but I'm not able view the dragged box in TimeLine Chart Area Portion.
please provide any sample for my above queries.
Thanks in Advance.
Thanks
Vivek K
Sorry for the delay!
So I always make sure that my primary interval is in the form of a day. I set the width of the primary interval to different sizes depending on what interval I am truly looking at. For instance, if I am looking at the week interval as my base, I set the primary interval column width to 10. Month is 4, and Year is 2. When I actually truly want the day as the base, then I set it to 0. I've found these values have served me really well.
The following is a snapshot of it set to week:
Now in the TimelineColumnHeaderInitializing event, I set the following so that the text doesn't display for the primary interval:
If e.DateTimeInterval.IsPrimaryInterval = True Then
e.Text = String.Empty
End If
Hope that helps!
Many thanks for this,
It is indeed at the interval levels other than day that I am struggling to get a specific placement of the bar - i have adopted a method which takes the days in the month and calculates this against the with of a TimeSlotUIElement and this way i get a rough idea of where a day would be, but it is not accurate or consistent!
So I was interested when yo said that you leave your interval as day but still show as week or month. How do you achieve that?
Many thanks
Simon
No problem :) First of all, I should say that even when I show my schedule by week or month, I still maintian my primary interval as days. I find if I don't do that, my bar representation isn't accurate. I utilize the header initialization event to essentially make the divisions of the primary interval not visible.
I've also modified my coding of the overlay significantly from the original sample because I felt this better suited my application.
So that in mind, this is what I have done. If you were to have the primary interval at anything else, you would have to adjust bolded width in the statements below by performing some logic such as dividing by the number of days in the week or in the month:
Dim El as TaskAreaUIElement=TryCast(parent, TaskAreaUIElement)
Dim e2 as TimeSlotUIElement
Dim ug as UltraGrid
ug = DirectCast(Me.UltraGanttView1.[GetType]().GetField("grid", System.Reflection.BindingFlags.CreateInstance Or System.Reflection.BindingFlags.Instance Or System.Reflection.BindingFlags.NonPublic).GetValue(Me.UltraGanttView1), UltraGrid)
If El IsNot Nothing AndAlso El.[GetType]()=GetType(TaskAreaUIElement) Then
e2=BaselineExecutionSchedule.UltraGanttView1.UIElement.GetDescendent(GetType(TimeSlotUIElement))
For each ugrow in BaselineExecutionSchedule.ug.rows
If ugrows.cells("BaselineStart1").value.tostring<>String.Empty And ugrow.cells("BaselineEnd1").Value.ToString<>String.Empty then
Dim item as New Task
Dim basestart as DateTime=Cdate(ugrow.cells("BaselineStart1").Value
Dim basend as DateTime=Cdate(ugrow.cells("BaselineEnd1").Value
Dim ts as TimeSpan=basestart=e2.DateTimeRange.StartDateTime
item.StartDateTime=basestart
item.Duration=baseend-basestart
item.Name="Baseline 1"
item.Tag=ugrow.cells("RowNumber")
item.TaskSettings.Enabled=DefaultableBoolean.False
Dim tb as New TaskUIElement(El, item)
tb.Rect = New Rectangle(e2.Rect.X + (ts.Days) * e2.Rect.Width, ugrow.GetUIElement.Rect.Y + 10, (item.Duration.Days + 1) * e2.Rect.Width, 10
El.ChildElements.Add(tb)
Next
I hope this is of some help to you! I know you we are told not to try to access the UltraGrid of the UltraGanttView, but I believe since we are not manipulating it and only gaining information it should be fine. It works perfectly for me.
HI Mictherr,
My apologies to ask via a reply to this thread but you seem to have solved an issue i am struggling with.
I am unable to accurately place a task on a timeline as i cannot accurately work out what the X axis should be. For a day interval it is fine but when it is a week or month i am struggling so wondered if you were able to assist in what you have already done?
Many thanks in advance
regards