Gantt for WinForms

1 Answer 71 Views
GanttView
Gerald
Top achievements
Rank 1
Gerald asked on 17 Aug 2022, 12:18 PM

Is it possible to control only the end of task.

I mean if I don't want the user to modify the start but let him modify the end, is it possible ?

For now I'm just able to set to readOnly the entire task and I want to get control when I let the user modify the task (and which part)

Gerald

Thx

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 22 Aug 2022, 04:39 AM
Hello, Gerald,  

There is no a straightforward way to allow changing only the end date for a task item. However, you can handle the ItemChanged event and set back the original task's start. Thus, the user will be allowed to change only the task's end while resizing. I have prepared a sample code snippet for your reference which result is illustrated below:
            this.radGanttView1.ItemChanged+=radGanttView1_ItemChanged;
            this.radGanttView1.SelectedItemChanged+=radGanttView1_SelectedItemChanged;

        private void radGanttView1_SelectedItemChanged(object sender, GanttViewSelectedItemChangedEventArgs e)
        {
            lastStart = e.Item.Start;
        }

        DateTime lastStart = DateTime.MinValue;
        private void radGanttView1_ItemChanged(object sender, GanttViewItemChangedEventArgs e)
        {
            if (lastStart!=DateTime.MinValue)
            {
                this.radGanttView1.ItemChanged-=radGanttView1_ItemChanged;
                e.Item.Start = lastStart;
                this.radGanttView1.ItemChanged+=radGanttView1_ItemChanged;
            } 
        }

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
GanttView
Asked by
Gerald
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or