Overview

This topic covers the specific events exposed by RadGanttView.

RadGanttView raises the following events, when a task is edited through the UI, in the order that they are shown below:

  • TaskEditing: Occurs when the task editing is initiated through the UI. Example 1 demonstrates how you can handle the event in order to cancel the editing based on a specific condition.

    Example 1: Canceling the editing of a task

        private void GanttView_TaskEditing(object sender, Telerik.Windows.Controls.GanttView.TaskEditingEventArgs e) 
        { 
            if (your condition here) 
            { 
                e.Cancel = true; 
            } 
        } 
    
        Private Sub GanttView_TaskEditing(ByVal sender As Object, ByVal e As Telerik.Windows.Controls.GanttView.TaskEditingEventArgs) 
            If your condition here Then 
                e.Cancel = True 
            End If 
        End Sub 
    
  • TaskSaving: Occurs when an edit operation is being committed through the UI. Please, note that you can handle this event to cancel the editing similarly to Example 1.

    The TaskEditing and TaskSaving events receive the following two arguments:

    • The sender argument contains the RadGanttView. This argument is of type object, but can be cast to RadGanttView type.

    • A TaskEditingEventArgs object. It contains the task that is being edited.

  • TaskEdited: Occurs when a task has been edited through the UI. Example 2 demonstrates how you can handle the event in order to show a MessageBox indicating the Duration of the task after it has been edited.

    • The sender argument contains the RadGanttView. This argument is of type object, but can be cast to RadGanttView type.

    • A TaskEditedEventArgs object. It contains the task that has been edited.

    Example 2: Show Task duration after it has been edited

        private void GanttView_TaskEdited(object sender, Telerik.Windows.Controls.GanttView.TaskEditedEventArgs e) 
        { 
            var durationAfterEditing = e.Task.Duration; 
            MessageBox.Show($"The duration after editing is - {durationAfterEditing}"); 
        } 
    
        Private Sub GanttView_TaskEdited(ByVal sender As Object, ByVal e As Telerik.Windows.Controls.GanttView.TaskEditedEventArgs) 
            Dim durationAfterEditing = e.Task.Duration 
            MessageBox.Show($"The duration after editing is - {durationAfterEditing}") 
        End Sub 
    

See Also

In this article
Not finding the help you need? Improve this article