Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
455
ultraGanttView1.TaskAdded event not firing
posted

Hello,

I am populating the Gantt Chart with a data bus and I have managed to get data published to the chart, but I need the TaskAdded event to fire and it is not firing.  I'm not sure why. 

My binding class sets all the bindings in the load event, like this:

            //  Set the BindingContextControl property to reference this form
            this.ultraCalendarInfo1.DataBindingsForTasks.BindingContextControl = this;
            this.ultraCalendarInfo1.DataBindingsForProjects.BindingContextControl = this;

            // Set the DataSource and DataMember for Project and Tasks using the SetDataBinding method
            this.ultraCalendarInfo1.DataBindingsForProjects.SetDataBinding(MissionRepository.Instance.PlanRepo, "Plans");
            this.ultraCalendarInfo1.DataBindingsForTasks.SetDataBinding(MissionRepository.Instance.PlanRepo, "Tasks");

            //  Set the DataBinding members for Projects
            this.ultraCalendarInfo1.DataBindingsForProjects.IdMember = "PlanGuid";
            this.ultraCalendarInfo1.DataBindingsForProjects.KeyMember = "PlanID";
            this.ultraCalendarInfo1.DataBindingsForProjects.NameMember = "PlanName";
            this.ultraCalendarInfo1.DataBindingsForProjects.StartDateMember = "PlanStartTime";

            //  Set the DataBinding members for Tasks
            // Basic Task properties
            this.ultraCalendarInfo1.DataBindingsForTasks.NameMember = "TaskName";
            this.ultraCalendarInfo1.DataBindingsForTasks.DurationMember = "TaskDuration";
            this.ultraCalendarInfo1.DataBindingsForTasks.StartDateTimeMember = "TaskStartTime";
            this.ultraCalendarInfo1.DataBindingsForTasks.IdMember = "TaskGuid";
            this.ultraCalendarInfo1.DataBindingsForTasks.ProjectKeyMember = "PlanID";
            this.ultraCalendarInfo1.DataBindingsForTasks.ParentTaskIdMember = "ParentTaskGuid";  
            this.ultraCalendarInfo1.DataBindingsForTasks.PercentCompleteMember = "TaskPercentComplete";
                 
            // All other properties
            this.ultraCalendarInfo1.DataBindingsForTasks.AllPropertiesMember = "AllProperties";

            this.ultraGanttView1.CalendarInfo = this.ultraCalendarInfo1;
            Project project = new Project();
            project.Key = MissionRepository.Instance.defaultProjectName;
            project.Name = MissionRepository.Instance.defaultProjectName;
            project.StartDate = DateTime.Now;
            this.ultraCalendarInfo1.Projects.Add(project);
            this.ultraGanttView1.Project = this.ultraGanttView1.CalendarInfo.Projects[1];
            
            this.ultraGanttView1.CreationFilter = new CurrentDayIndicatorCreationFilter();
            this.ultraGanttView1.GridAreaWidth = 400;

The binding's Designer code activates the TaskAdded handler:

           this.ultraGanttView1.TaskAdded += new Infragistics.Win.UltraWinGanttView.TaskAddedHandler(this.ultraGanttView1_TaskAdded);

I see the new data on the gantt view, but the code never stops at the TaskAdded event.  Any ideas on why this is happening? 

Thanks,

Myca

Parents
No Data
Reply
  • 2165
    posted

    Hello Myca,

    Thank you for the provided code snipped.

    The reason why the TaskAdded event is not fired is because it only fires after the user adds a task. In your scenario the tasks are taken from a data source and thus the event could not be fired. What I could recommend to you for your scenario is to use the TaskDataInitialized event that occurs when a task instance is created via data binding.  It fires after every task taken from the data source.

    To see how the TaskDataInitialized event works I’ve implemented a simple sample, and you could run and evaluate it, please see attached zip.

    I hope that this will help you.

    Please do not hesitate to contact me if you have any further question.

    UltraGanttViewEventFire.zip
Children