GantViewDataItem - forbid resize but not dragDrop

1 Answer 49 Views
GanttView
Fabrice
Top achievements
Rank 2
Iron
Fabrice asked on 25 Jan 2022, 03:49 PM

Hi,

I'm looking for a way to forbid resizing a task but allow users to move them to another time.

If found issues about blocking events (https://www.telerik.com/forums/how-to-disable-edit-add-new-delete-items), but it implies to "cancelstart" on the dragDropService.

I can't find an event that gives me enough information to choose between "allow" and "cancel" modification if its "move" or "resize"

 

ps: I had to remove packages of the solution so it respects the 20MB limit, hope that won't cause any trouble.

 

Thanks for your time and help.

 

Simon.

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 28 Jan 2022, 11:42 AM

Hello, Fabrice,

If you want to disable only resizing the tasks, it is possible to handle the CursorChanged event and reset the cursor back to the default one:

        private void SGanttView_CursorChanged(object sender, EventArgs e)
        {
            if (this.SGanttView.Cursor== Cursors.SizeWE)
            {
                this.SGanttView.Cursor = Cursors.Default;
            }
        }

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/.

Fabrice
Top achievements
Rank 2
Iron
commented on 07 Feb 2022, 08:35 AM | edited

Hi,

Thanks for the answer, but unfortunately this won't work for me. Even though the cursor shows that you can't resize, you still can.

I can't afford the risk that a user find out, that he can resize without a proper cursor. There are no cancellable event that I can subscribe to, ganttview or sub element?

 

Thanks in advance

Dinko | Tech Support Engineer
Telerik team
commented on 09 Feb 2022, 02:22 PM

In this case, you can create a custom GanttViewBehavior and override the ProcessMouseMoveWhenResizingTask() method. You can prevent the base logic from executing. This way the user won't be able to resize a task.

SGanttView.GanttViewElement.GanttViewBehavior = new CustomGanttViewBehavior();

public class CustomGanttViewBehavior: BaseGanttViewBehavior
{
    protected override void ProcessMouseMoveWhenResizingTask(GanttGraphicalViewBaseTaskElement element, MouseEventArgs e)
    {
        // base.ProcessMouseMoveWhenResizingTask(element, e);
    }
}

Fabrice
Top achievements
Rank 2
Iron
commented on 16 Feb 2022, 10:08 AM

Thanks, its works fine!
Tags
GanttView
Asked by
Fabrice
Top achievements
Rank 2
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or