Good morning,
when i add a task in my task collection (ListaReg) I use:
Dim TDM As New TaskDetails
TDM.StartDate = New Date(Now.Year, Now.Month, Now.Day)
TDM.FinishDate = TDM.StartDate.AddDays(3)
VM.ListaReg.Add(TDM)
if we are at the first of december, in the task grid i can see start date: 01/12/2021 (12:00 AM) and finisch date 03/12/2021 (12:00AM). The duration i get is 2 days because the start date is at 12:00 AM (midnight) of the first day (at the beginning of it) and the end date is at the beginning od the third days This means the only 1 and 2 dicember are counted because they are fully included in the dates interval while the 3rd of december is not counted becuse the interval finish at 12:00 AM (beginning of 3rd day) . which date, and time, should i have on the 3rd day, the finishdate, to have it counted on duration?
Hope to be clear,
thank You
Best regards
<Window.DataContext>
<local:ViewModel />
</Window.DataContext>
<Grid>
<gantt:GanttControl x:Name="gantt"
ShowDateWithTime="True"
ItemsSource="{Binding TaskDetails}" />
</Grid> |
TaskDetails = New ObservableCollection(Of TaskDetails)()
TaskDetails.Add(New TaskDetails With {
.TaskId = 1,
.TaskName = "Task 1",
.StartDate = New DateTime(2021, 12, 1),
.FinishDate = New DateTime(2021, 12, 4)
}) |
Thank You for Your answer.
Your sample is clear to me. What i would need instead is that when i set the same dates You set, the duration shown is 4 days because i want that all the days are fully counted : I have 1, 2, 3, and 4th of december, thus 4 days, not 3. I tried to set the finish date at the 23:59 of the 4th december but, depending on the value of ShowDateandtime property, the duration is 3 days or 3 days and 23 hours and 59 minutes.
is something similar You can see here
https://help.syncfusion.com/angular/gantt/how-to/duration-round-off
but i can0t find in WPF Gantt
I guess i have to add a custom property to show what i need but it seems to me quite diffulcult because of the week end and holydays.
Thank You